Monday 24 July 2017

Program to input characters and change theie case.

PROGRAM
Program to input characters and change theie case.

      #include<iostream.h>
      #include<conio.h>
      #include<stdio.h>
       int main()

        { char ch;
            clrscr();
       do
           {  cout<<"Enter a character:";
               ch=getchar();
               if(ch=='\n')
              ch=getchar();
              cout<<endl;
              if(ch>=65&&ch<=90)
             ch=ch+32;
       else
              if(ch>=97&&ch<=122)
              ch=ch-32;
              putchar(ch);
             cout<<endl;
         }     while(ch!='0');
                 getch();
                 return 0;
   }
========================================================================
   OUTPUT
 
  Enter a character:R
      r
    Enter a character:a
      A
    Enter a character:0
      0
 ========================================================================  

No comments:

Post a Comment