C++ program to convert lowercase character to uppercase and vice versa
In this program, we will learn how to convert an entered character from lowercase to uppercase and uppercase to lowercase in C++?
Here, we will read a character and check whether it is a valid alphabet or not, if it is a valid alphabet (from A-Z or a-z), we will check uppercase character, if it is uppercase character - we will convert it into lowercase character and if it is in Lowercase character - we will convert it into uppercase character.
To convert uppercase to lowercase - we are adding 32 in the ASCII value of uppercase character because the difference between Uppercase and Lowercase characters are 32. Same to convert lowercase character to uppercase - we are subtracting 32 in the ASCII value of lowercase character.
Program to convert lowercase to uppercase and vice verse in C++
Output
need an explanation for this answer? contact us directly to get an explanation for this answer