Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please provide explanations. Use C++ You should submit an single electronic package that contains the source files for your work on the programming questions, by
Please provide explanations. Use C++
You should submit an single electronic package that contains the source files for your work on the programming questions, by following the submission procedure described in class and on the class discussion forum. Using the discussion forum to clarify details of both the main program and the submission format and procedures is an important part of this homework. You are welcome to use any inanimate resources (e.g., books, Web sites, publicly available code) to help you with your work. However, all such help must be clearly noted in your submissions. Further, no matter what you use, you must be able to explain, in detail, how it works. (You may be called upon to explain your homework individually.) Refer to the class policy for details, and ask for clarifications if you are unsure if something is allowed. Your implementation must use clean, portable C++ that not only conforms to the C++17 standard but also minimizes dependencies and, as much as possible, uses only material in Chapters 1 through 6 of the textbook. (If in doubt, please ask.) Packaging and documentation of code are worth a very significant portion of the grade. This homework centers on writing a program that produces text-based graphics (sometimes called ASCII graphics). For now, we will focus on drawing only a single rectangle on a text-based canvas that has a fixed size of 80 columns (width) by 24 rows (height). The rectangle is specified using the coordinates of its top-left corner (column, row) and its width and height. The coordinates on both axes (horizontal/columns and vertical/rows) start at 0 and proceed as successive integers. Thus the top-left corner has coordinates (column, row) (0,0) while the bottom-right corner has coordinates (79,23). Input-output: The program should read its input from the standard input stream and write its output to the standard output stream. Optional diagnostics may be written to the standard error stream. It is very important that the program read its input only from the standard in put stream and that it write nothing except the specified output to the standard output stream. In particular, there should be no prompts or informational messages printed to standard output. The input consists of four non-negative integers separated by one or more white-space characters (and may thus span multiple lines). The output consists of (only) the canvas with the rectangle specified by the input drawn on it. In more detail, the output is exactly 24 lines, many of which may be empty. Lines occupied by the rectangle include spaces to the left of the rectangle and in its interior, with the edges of the rectangle drawn using the * character. The output should not include any characters other than space (not tab or other white-space), *, and newline. Further, spaces should be present exactly as specified above in order to allow the rectangle to appear with the specified location and size, and nowhere else. There is exactly one (i.e. a unique) output for any given input (but there may be multiple inputs resulting in the same output). If two outputs for the same input differ by even a single character/byte then at least one of them is incorrect. The following sample input and output illustrates these detailsStep 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