C++ language

Convert To Upper Case
Previous Home Next

Program To Convert An Input Lower Case In Upper Case

#include<iostream.h>
void main()
{
char str[20],*s;
cout<<"\n enter the string";
cin>>str;
s=str;
while(*s!='\0')
{
if(*s>=97&&*s<=122)
*s=*s-32;
*s++
}
cout<<"\n string is upper case"<<str;
}

Output:

Enter the string
computer
string in upper
COMPUTER
Previous Home Next