C++ Program To Convert Character Cases
Write C Program to convert a character from upper to lower and lower to upper case
// Write C program to convert case of entered character #include<iostream> using namespace std; int main() { char upper, lower; // declare variables int ascii; // convert in lower case cout << "Enter the Upper Case Character :--> "; cin >> upper; ascii = upper + 32; cout << "Lower case of " <<upper <<" : " << char(ascii); // convert in upper case cout << "\n\nEnter the Lower Case Character :--> " ; cin >> lower; ascii = lower - 32; cout << "Upper case of " << lower << " : " << char(ascii); return 0; }
Output:
Enter the Upper Case Character :--> M
Lower case of M : m
Enter the Lower Case Character :--> g
Upper case of g : G