- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Programs for practice
To convert the uppercase string into lowercase string in C++ programming, you have to ask to the user to enter the string, now start converting lowercase string to uppercase string by using ASCII values. To convert lowercase to uppercase, just minus 32 from the all string's character since the ASCII value of A is 65 and the ASCII value of a is 97. That is, 97-65=32. So to convert string from lowercase to uppercase just minus 32 from each character of the string as shown here in the following program.
Source Code: Lowercase to Uppercase Conversion of String in C++
/* C++ Program - Lowercase to Uppercase Conversion */ #include<iostream.h> #include<conio.h> #include<string.h> void main() { clrscr(); char str[20]; int i; cout<<"Enter the String (Enter First Name) : "; cin>>str; for(i=0;i<=strlen(str);i++) { if(str[i]>=97 && str[i]<=122) { str[i]=str[i]-32; } } cout<<"\nThe String in Uppercase = "<<str; getch(); }Output
Enter the String (Enter First Name) :blazingminds The String in Uppercase =BLAZINGMINDS