Q-25: Write a C/C++ program to convert all characters of given string to uppercase.
    

Using - C


#include<stdio.h> #include<ctype.h> void main() { char str[1024]; int i; printf("Enter the String: "); gets(str); for(i=0; str[i] != '\0'; i++) { str[i] = toupper(str[i]); } printf("%s",str); }

OUTPUT

Enter the String:  welcome
WELCOME

        

Using - C++


#include<iostream> #include<ctype.h> using namespace std; int main() { string str; cout<< "Enter the String: "; getline(cin,str); for(int i=0; str[i] != '\0'; i++) { str[i] = toupper(str[i]); } cout<< str; return 0; }

OUTPUT

Enter the String:  how are you ?
HOW ARE YOU ?