Write a program that will draw a box of asterisks on the


Write a program that will draw a box of asterisks on the screen. Your program will prompt the user to enter the number of asterisks they want on a line as you did for Daily 10. Your program should print a message indicating that the number must be in the range 1 to 79 if the user enters a number outside of that range.

Your program should continue this behavior until you have received an appropriate integer. Use a loop to trap the user until you get the value that you want. You should also clear the keyboard buffer after each scanf so that the user can type characters or digits in their response.

Once you have a number in the appropriate range prompt the user to enter the number of lines the user wants in a box. Use the same procedure as above but force the user to enter a value between 1 and 23.

Once you have both numbers, call a function that you write called draw_box that takes two arguments of type integer where the first argument represents the number of lines and the second argument represents the number of asterisks in each line. In the draw_box function use a loop to call the draw_line function you created in daily10 the appropriate number of times to draw the requested box.

You may notice that the code to force the user to input an integer in a specified range is very similar between asking for the number of asterisks in a line and asking for the number of requested lines. You may want to try using a function that takes two arguments, a starting acceptable value and an ending acceptable value.

The function can then handle all the work involved in reading in a value and checking to see if it is in the specified range. Once you have a value in the specified range you can return it and save it in a variable in the calling function. This functionality is OPTIONAL for this assignment.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Write a program that will draw a box of asterisks on the
Reference No:- TGS01134550

Now Priced at $20 (50% Discount)

Recommended (98%)

Rated (4.3/5)