Answer:
Written in C++
#include<iostream>
using namespace std;
int main() {
char myword[] = {'T','a','k','e',' ','m','e',' ','t','o',' ','C','l','e','a','r','w','a','t','e','r',' ','B','e','a','c','h','!', '\0'};
for (char *i = myword; *i != '\0'; ++i){
if( *i >= 'a' && *i <= 'z'){
*i -= 'a' - 'A';
}
}
cout<<myword;
return 0;
}
Explanation:
This line initializes the string to a char array
char myword[] = {'T','a','k','e',' ','m','e',' ','t','o',' ','C','l','e','a','r','w','a','t','e','r',' ','B','e','a','c','h','!', '\0'};
This iterates through the char array
for (char *i = myword; *i != '\0'; ++i){
This checks for uppercase or lowercase
if( *i >= 'a' && *i <= 'z'){
This converts to lowercase
*i -= 'a' - 'A';
}
}
This prints the new string in all uppercase
cout<<myword;