11/04/2015

C++ Program To Convert String Lowercase To Uppercase

Problem:- C++ Program To Convert String Lowercase To Uppercase or ++ Program to Convert Lowercase to Uppercase or C++ Program to convert a lowercase alphabet to uppercase
Changing lowercase to upper case letter or C++ program To change the case (uppercase to lowercase) or Case conversion (Lower to Upper and Vice Versa) of a string or C program to change the case of a string or C++ Program to Convert a String from Lowercase to Uppercase.

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.


Logic:- This Problem Can Solve using ASCII Value Please check this program for better understanding the given problem this program clear your doubts on ASCII values C++ program to print ASCII value of a character. after checking the program also check the below program for convert string Lower case to upper case and upper case to lower case. If you do not know how to do this C++ Program To Check Upper Case Lower Case Digit And Special Symbol. Now you Can Modify or you need to little modification.

String =String-32

After taking an input from the user we have to minus 32 in each character of a string so in this way we can convert the string lower case to upper case. This is why I already mention link above. For better practice, I strongly recommended to check and practice below post for the logic building if you are new in Programming.

Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page.


Solution:-


#include<iostream>

using namespace std;

void upr(char*);

int main()
{
    /*Visit - www.programmingwithbasics.com*/

    char str[50];
    
    cout<<"=====================================";
    cout<<"\nVisit - www.programmingwithbasics.com";
    cout<<"\n=====================================";
    
cout<<"\n\nEnter a Lower Case String :";
    cin>>str;
    
upr(str);
    
cout<<"\n\nUpper Case String Is :"<<str<<endl<<endl; 
}
void upr(char *str)
{       
    int i=0;
    
    while(str[i]!='\0')
    {
        str[i] = str[i] - 32;
        i++;
    }  
}

Output:-

C++ Program To Convert String Lowercase To Uppercase

You May Also See

1. C Program To Find Area And Circumference Of Circle

2. C Program To Print ASCII Value Of Character

3. C Program To Find Area Of Triangle

4. C Program to Convert a person's name in Abbreviated

5. C Program For Calculate A Simple Interest



No comments:

Post a Comment