To print a character in its opposite case in c++
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
cout<<endl<<"Enter a character: ";
cin>>ch;
if(ch>=65&&ch<=90)
{
ch+=32;
}
else if(ch>=97&&ch<=122)
{
ch-=32;
}
cout<<endl<<"converted case : "<<ch;
getch();
}
For Further Reading,
0 comments:
Post a Comment