Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using a repetition control statement, query the user to enter in the length of the side of a square and then print a hollow square

Using a repetition control statement, query the user to enter in the length of the side of a square and then print a hollow square of that length using plus symbols in its corners, dashes across the top and bottom, vertical bars | down the sides, and space characters in the center.

image text in transcribedimage text in transcribedimage text in transcribed

Using a repetition control statement, query the user to enter in the length of the side of a square and then print a hollow square of that length using plus symbols in its corners, dashes across the top and bottom, vertical bars | down the sides, and space characters in the center. Your program should use the following prompt: Enter length between and 64 (-1 to exit): If a length of- s entered, then terminate the query loop. An error message should be issued when a length less than -1 or greater than 64 is entered Prior to printing a square, print the length entered. Be sure your program knows how to print squares having lengths of e, 1 and 2, respectively. [A square of length e should result in the printing of a blank linc.] Prior to terminating the program, print the number of squares printed and the average length. Your program must use all three of the repetition control statements. Your program must be modularized into the following functions. int getlnput(void); function prototype This function prompts the user to enter an integer. After extracting data from cin, if cin.fail) is true, then print an error message and return -1. If a negative integer is entered, then print an error message and re-prompt the user, otherwise, return the integer. If getInput0 returns a -1, then the calling function should print the number of squares printed along with their average length using the printStats function and terminate the program void printine(char, char, int); l/function prototype

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899