Thursday, September 27, 2018

Changing case into reverse case (Toggle case)

#include<ctype.h>
#include<iostream>
using namespace std;

main()
{

char ch;
cout<<" Enter a character ";
cin>>ch;

cout<<"Enter Character = "<<ch;
// Convert the characetr into Toggle Case
if(islower(ch))
ch=toupper(ch);

else
if(isupper(ch))
ch=tolower(ch);

cout<<"Changed case character  = "<<ch;

}

No comments:

Post a Comment