Q:

C++ Program To Convert String Lowercase To Uppercase

0

Logic:-

This Problem Can Solve using ASCII Value .

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>

using namespace std;

void upr(char*);

int main()
{
    char str[50];
    
    cout<<"=====================================";
    cout<<"\nVisit - www.nerdutella.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:

=====================================

Visit - www.nerdutella.com

=====================================

Enter a Lower Case String :nerdutella

Upper Case String Is :NERDUTELLA

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Program To Reverse a Sentence or String... >>