Convert Lower Case to Upper Case & Vice Versa in CPP

#include<iostream.h>
#include<conio.h>
#include<ctype.h>

void main()
{
char ch;
clrscr();
cout<<"Enter any character of your choice: ";
cin>>ch;
if(islower(ch))
{
cout<<"The entered character "<<ch<<" is lower case...\n";
cout<<"The reverse of character is "<<(char)(toupper(ch))<<endl;
}
else
{
cout<<"The enetered character "<<ch<<" is upper case...\n";
cout<<"The reverse of character is "<<(char)(tolower(ch))<<endl;
}
getch();
}

No comments

Post your comments

Powered by Blogger.