Question: I use C++ compiler Your task is to draw a rectangle of a size (number of rows and columns) specified by the user. The rectangle

 I use C++ compiler Your task is to draw a rectangle

I use C++ compiler

Your task is to draw a rectangle of a size (number of rows and columns) specified by the user. The rectangle should have a "special" character (specified by the user) at the corners of the rectangle, inset by one row and column from the edges. Example run (user input in bold): Number of rows: 12 Number of columns: 35 Special character: 0 40- -8 Hints Suggested approach: (1) First, write the code to prompt the user for the number of rows and columns and the "special" character You can read a single non-whitespace character into a variable as follows: char special; scanf(" c", &special); Note: there is a single space character preceeding the %c in the scanf format string. (2) Add code to print a "solid" rectangle of the given size. L.e., don't worry about printing the "special" character at the comers. You should use a pair of nested loops. The outer loop is responsible for generating all of the rows of output making up the rectangle. The inner loop is responsible for printing a single row of the rectangle by repeatedly printing a period("." character The program will need to print a newline (n) character at the end of each row (3) Change the code that prints the period character so that it is an if/else statement of the following form: The idea is that a condition (should be a special character) determines when the special character should be printed. You wil need to think about how to specify this condition. The code above assumes that the char variable called special stores the special character entered by the user

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!