C++ Program to convert lowercase string to uppercase
In this program, You will learn how to convert lowercase string to uppercase in C++.
Enter a String: hello
Uppercase String is: HELLO
Example: How to convert lowercase string to uppercase in C++.
#include<iostream>
using namespace std;
int main() {
char str[100];
int i = 0;
cout << "Enter a string:";
cin.getline(str, 100);
while (str[i] != '\0') {
i++;
}
for (int j = 0; j < i; j++) {
if (str[j] >= 97 && str[j] <= 122)
str[j] = str[j] - 32;
}
cout << "Uppercase string is:" << str;
return 0;
}
Output:
Enter a string:xiith.com
Uppercase string is:XIITH.COM