Question: Write a complete C + + program that does the following: Prompts the user for two lower case letters. The first letter must precede the

Write a complete C++ program that does the following:
Prompts the user for two lower case letters. The first letter must precede the second in alphabetical order. Also, the characters
cannot be the same. For example, 'e' followed' by 'h' are valid inputs, but 'h' followed by 'e' is invalid.
If the user enters invalid inputs, force the user to enter valid inputs.
Hint: cast each char as an int and store the result for each in an int variable. Compare the two ints to determine if one precedes
the other.
Pass these two characters as input to a f
unction called printStripedSquare that prints a 5 x 5 square with the following properties:
Odd numbered rows consist of the first char.
Even numbered rows consist of the second char.
Example main f
unction that uses printStripedSquare:
int main(){
char a, b;
int x, y;
cout << "Enter two characters, first must precede second in alphabetical order: ";
cin >> a >> b;
x =(int) a;
y =(int) b;
while(FILL IN){
FILL IN
}
printStripedSquare(a, b);
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!