Wednesday, October 19, 2011

Program: To print a character in its opposite case in c++




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();
}    

Article by
Chief-Editor

He is a tech Enthusiast, an Altruist and calm mentor. He loves to code. He is also a creative graphic designer. Do check out his designfolio @ Jasmeet.asia If you like This post, you can follow me on Twitter.



For Further Reading,
C++ Program

0 comments:

Post a Comment