Convert the Lower Case to Upper and Upper to Lower Case in C++


#include <iostream.h>
#include <conio.h>
#include <string.h>
#include <ctype.h>

void main ()
{
      char c[]="Hello";
      int i,t;
      clrscr();

     for (i=0;c[i]!='\0';i++)
     {
if(isupper(c[i])!=0)
{
  c[i]=tolower(c[i]);
}
else
{
  c[i]=toupper(c[i]);
}
     }
     cout<<c;
getch();
}

No comments

Post your comments

Powered by Blogger.