Answer:
#include <iostream>
using namespace std;
int main()
{
const int LENGTH = 9;
char sample1[LENGTH];
char sample2[LENGTH];
cout << "Enter 9 characters to be converted to uppercase: ";
for(int i = 0; i < LENGTH; i++){
cin >> sample1[i];
sample1[i] = toupper(sample1[i]);
cout << sample1[i];
}
cout << endl;
cout << "Enter 9 characters to be converted to lowercase: ";
for(int i = 0; i < LENGTH; i++){
cin >> sample2[i];
sample2[i] = tolower(sample2[i]);
cout << sample2[i] ;
}
return 0;
}
Explanation:
- Declare the variables
- Ask the user for the characters
- Using for loop, convert these characters into uppercase and print them
- Ask the user for the characters
- Using for loop, convert these characters into lowercase and print them