#include<iostream.h>
#include<conio.h>
char ch;
char cse(char ch)
{
if((97<=int(ch))&&(int(ch)<=122))
{
cout<<"\nThe given character is in lowercase"
<<"\nThe corresponding uppercase is - ";
return(char(int(ch)-32));
}
else if (65<=int(ch)<=90)
{
cout<<"\nThe given character is in uppercase"
<<"\nThe corresponding lowercase is - ";
return(char(int(ch)+32));
}
}
void main()
{
clrscr();
cout<<"Enter a character : ";
cin>>ch;
cout<<cse(ch);
getch();
}
.................................................................
OUTPUT:(click to enlarge the image)
And what if i wanna convert a whole word or sentence??? :?
ReplyDeleterefer to this program : http://basiccplusplus-asim.blogspot.com/2012/01/case-conversion-in-string-using-logic.html
ReplyDelete