Followers

Showing posts with label CHARACTERS. Show all posts
Showing posts with label CHARACTERS. Show all posts

Saturday, December 10, 2011

INTER CONVERSION OF CASES OF ALPHABET--USING LOGIC

#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)