top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Write a C++ program to print the Rectangle?

0 votes
594 views
Write a C++ program to print the Rectangle?
posted Feb 2, 2019 by Gutu Kitessa

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
#include <iostream>
#include <iomanip>

using namespace std;

void PrintChar(int row = 5, int column = 10, char symbol = '*');

int main() {

    int rows, columns;
    char symbol;

    cout << "How many rows and columns do you want, and with what symbol (default     is *) ?" << endl;
    cin >> rows >> columns >> symbol;

    PrintChar(rows, columns, symbol);

    return(0);

}

void PrintChar(int row, int column, char symbol) {
    for (int y = 1; y <= column; y++) {
        for (int x = 1; x <= row; x++) {
            cout << symbol;
        }
        cout << endl;
    }
}
answer Feb 2, 2019 by Salil Agrawal
...