Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions

Question

What do you think of the MBO program developed by Drucker?

Answered: 1 week ago