Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started