Question: Create a function that takes two integers as parameters (width and height in that order) and prints a rectangle of pluses and dashes as shown

Create a function that takes two integers as parameters (width and height in that order) and prints a rectangle of pluses and dashes as shown below to the screen using only WHILE loops. Do not use for loops. If a value less than 1 is passed as an argument, the function should not print anything. The rectangle should be printed with only dashes (minus), plus signs, and newlines. Each line should end with a newline. There should be no spaces or extra characters anywhere.

For example: printRectangleWhile(10, 6); should print a rectangle with 10 columns and six rows as shown below.

This function should be executed be another file like this:

#include

//Sample main.cc

void printRectangleWhile(int, int);

int main() {

printRectangleWhile(10, 6);

}

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!