Question: Please attach a screenshot of the code in the editor, Thank you! Write a program (Q2.cpp) that asks the user to provide a character and

 Please attach a screenshot of the code in the editor, Thank

Please attach a screenshot of the code in the editor, Thank you!

Write a program (Q2.cpp) that asks the user to provide a character and an integer between 1 and 100 and prints a "pyramid" on the screen, composed of the chosen character and with the chosen number as height. Upon receiving an invalid height, the program shouldn't exit but it should print an error and ask the user to input another value (see sample run below). An invalid height is a number higher than 100, a negative one, zero, or a value that is not a number (e.g.. 'a'). You can disregard the case in which the user inputs a decimal number. Sample run 1 Enter a character: Enter a height (between 1 and 100):5> Sample run 2: Enter a character: Enter a height (between 1 and 100):6> Sample run 3: Enter a character: Enter a height (between 1 and 100): Error! You specified an invalid height! Enter a height (between 1 and 100):3>

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!