Question: C + + Q 1 : [ Print M or W ] Write a program to meet all the following requirements: Receive two input values.

C++Q1: [Print M or W]
Write a program to meet all the following requirements:
Receive two input values.
a. An integer representing the size of the letter (M or W to print. It represents the number
of lines of the whole letter to be printed out.
b. A character which indicates to print M or W or "Wrong Input!". If this character is M,
then output a shape of M (see below); if this character is W, output a shape of W.
Otherwise the program will print "Wrong input!".
The shape of M can be seen as two isosceles triangles without the base edges, the bottom-right
vertex of the first triangle overlaps the bottom-left vertex of the second triangle. The shape of W
is the upside down the shape of M.
NOTE:
1: When the height is less than(or equal to)1, the output should be "Wrong input!"
2: M or W should be case sensitive.(that means if the input char is "m" or "n", the result should be
"Wrong input!")
Example 1:
Example 2:
Please input the height (integer):
5?
Do you want to print M or W?:
W
,*,*
******
Example 3:
Please input the height (integer):
5
Do you want to print M or w?
A
Wrong input!c
 C++Q1: [Print M or W] Write a program to meet all

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!