Question: this program is written in the C++ language. The amount of lines the hourglass can have is 25 but not less than 3. If the

 this program is written in the C++ language. The amount of

this program is written in the C++ language. The amount of lines the hourglass can have is 25 but not less than 3. If the user enters less than 3, the program promts "this is too few rows for me to make an hourglass" and if the user enters greater than 25, the program prompts "this is too many rows for me to make an hourglass" if the user enters an even number, the program adds one to the input to make it an odd number to create the hourglass. This uses only for loops and nested for loops. Thank You so much for the help.

write a program that prompts for a number of rows (nRows) from the user, and prints an hourglass of either nRows or nRows-1 rows. Your should only print hourglasses of 3 to 25 rows (to let the shape fit on a single screen), so force the user to enter a reasonable number of rows. Print different error messages if nRows is too big or too small. Then, if nRows is even, add one to get an odd number of rows. The first and last rows of the hourglass must abut the left margin. You may only print single character spaces or stars T. and newline An flush or endl. You may not M use any output manipulators, e.g., setw in this program. For example, if user enters 9 for number of rows, the hourglass will have g stars on the first line, 7on the second, 5 on the third, 3 on the fourth, then 1, 3, 5, 7,9 stars on the rest of the lines.You may use For Nested Loop sto print the shape itself. For example, you could have a nested For Loop structure that writes the top (inverted triangle of stars, then a second nested For- Loop structure that write the bottom triangle of stars.l don't want any if statements used. Do this all with For loops.You will have a fourth outer loop to force user entry to be reasonable. You MUST do the number-of-spaces and number-ofstars calculations for each row based ONLY on the total number of rows and the current row number. You MAY NOT use the previous line's number of spaces er stars for these caleulations. mple (with user entries shown in bold italic): of rows Enter That is to few rows for me to make an hourglass 30 Enter number of rows ourglass That is too many rows for me make an Enter number of rows 4 ce this becomes 5 rows

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!