#include <iostream.h>
#include <conio.h>
#include<string.h>{
char str[30], choice;
cout<<"\n Enter A String :";
cin.getline(str,30);
int t,i;
do{
cout<<"*************** MENU ********************\n";
cout<<"\n\n 1. UPPERCASE.";
cout<<"\n 2. LOWERCASE.";
cout<<"\n 3. TOGGLECASE.";
cout<<" Enter your choice (1-2-3)";
cin>>t;
switch(t)
{
case 1:
for( i = 0; str[i] != '\0' ; i++)
str[i] = toupper(str[i]);
cout<< "\n The output =" << str;
break;
case 2:
for( i = 0; str[i] != '\0' ; i++)
str[i] = tolower(str[i]);
cout<< "\n The output =" << str;
break;
case 3:
for( i = 0; str[i] != '\0' ; i++)
{
if(isupper(str[i])
str[i] = tolower(str[i]);
if(islower(str[i])
str[i] = toupper(str[i]);
}
cout<< "\n The output =" << str;
break;
default:
cout<<"\n Invalid choice.";
}
cout<<"\n Do you continue ?(Y/N)";
cin>>choice;
}while(toupper(choice)= ='Y');
}
No comments:
Post a Comment