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
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