change uppercase to lowercase in C++ by R4R Team

UPPERcase alphabet:

Example-
A,B,C,D,.........,X,Y,Z
All these alphabet is the upper case.
ASCII value for upper case alphabet:
A=65
B=66
C=67
.....
Y=89
Z=90

Lower-case alphabet:

Example-
a,b,c,d,...........,x,y,z
All these alphabet is of lower case.
ASCII value for lower case alphabet:
a=97
b=98
c=99
.....
y=121
Z=122


program:

#include < iostream>
using namespace std;
int main()
{
char s;
cout<<"Enter Character in upper case"<< endl;
cin>>s;
cout<<"It's lower case is: "<< char(s+32);
return 0;
}


output-

Enter Character in upper case
R
It's lower case is: r

-In this program, we take a input of the UPPER case alphabet and try to convert it into the lower case alphabet.

-We use ASCII value to do this.

-Difference between ASCII value of UPPER case and lower case alphabet is 32.

-So 'UPPER_CASE'+32=lower_case







Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!