Question: Write an interactive C++ program that gets a single input of an integer. Use nested repetition control structures better known as loops to output a
Write an interactive C++ program that gets a single input of an integer. Use nested repetition control structures better known as "loops" to output a hollow square shape using just the specific characters +, - and |, similar to the sample output provided above. Notice that the number of characters (ie., width and height) is specified by the user input of a single integer value. Don't use the setw manipulator or output hard-coded strings containing a rigid number of specific characters and spaces all elements must be created dynamically using loops!
Your task is to achieve the following goals:
ask the user to enter a positive integer value greater than 2 (n);
check the entered value and if it isn't legal, output a message stating the reason;
draw a square with a side of n using the characters +, - and | (see sample output above)
Find a reasonable upper limit for n (depending on your screen's dimensions or an acceptable range) and embed it into your input validation code.
Input Validation: Ensure that the user inputs a positive integer value greater than 2 and does not exceed an acceptable range determined by you. Do not accept negative or non numeric values.

Drawing Squares Program * Algorithm generates a hollow square, using the character +, - and|* *Acceptable size dimension: Any value from 3 to 20. Choose carefully. Side size 3 To try my shape generator program again type Y for Yes and N for No: Y Side size2 OOPS! Looks like you typed some bad data here! The acceptable dimension should range from 3 to 20, so choose carefully... side size = 21 OOPS! Looks like you typed some bad data here! The acceptable dimension should range from 3 to 20, so choose carefully... Side size -Ada Lovelace OOPS! Looks like you typed some bad data here! The acceptable dimension should range from 3 to 20, so choose carefully... Side size-8 To try my shape generator program again type Y for Yes and N for No: N Now exiting the shape generator program....... Process returned 0 (0x0) execution time 46.838 s Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
