PROGRAM
//Program to toggle case of string
#include <iostream>
using namespace std;
int main()
{
int i,len;
string str;
cout<<"ENTER STRING: ";
getline(cin,str);
len=str.length();
for(i=0 ; i<len ; i++)
{
if(str[i]>= 'a' && str[i]<= 'z')
{
str[i] = str[i]-32;
}
else if(str[i]>= 'A' && str[i]<= 'Z')
{
str[i] = str[i]+32;
}
}
cout<<"TOGGLED STRING: "<<str;
return 0;
}
OUTPUT
//Program to toggle case of string
#include <iostream>
using namespace std;
int main()
{
int i,len;
string str;
cout<<"ENTER STRING: ";
getline(cin,str);
len=str.length();
for(i=0 ; i<len ; i++)
{
if(str[i]>= 'a' && str[i]<= 'z')
{
str[i] = str[i]-32;
}
else if(str[i]>= 'A' && str[i]<= 'Z')
{
str[i] = str[i]+32;
}
}
cout<<"TOGGLED STRING: "<<str;
return 0;
}
OUTPUT
1 comments :
commentsDoing Awesome Bro.....
ReplyKeep it up