題意:輸入寬和高,輸出一個矩形,並且每次輸出完最後要加一個空行
/*
*
*Problem Description
*Give you the width and height of the rectangle,darw it.
*
*
*Input
*Input contains a number of test cases.For each case ,there are two numbers n and m (0 < n,m < 75)indicate the width and height of the rectangle.Iuput ends of EOF.
*
*
*Output
*For each case,you should draw a rectangle with the width and height giving in the input.
*after each case, you should a blank line.
*
*
*Sample Input
*3 2
*
*
*Sample Output
*+---+
*| |
*| |
*+---+
*
*
*Author
*xhd
*
*
*Source
*校慶杯Warm Up
*
*
*Recommend
*linle
*
*/
#include<iostream>
#include<iomanip>
using namespace std;
int main() {
int col, row;
while (cin >> col >> row) {
cout << "+";
for (int i = 0; i < col; i++) {
cout << "-";
}
cout << "+" << endl;
for (int i = 0; i < row; i++) {
cout << "|";
for (int j = 0; j < col; j++) {
cout << " ";
}
cout << "|" << endl;
}
cout << "+";
for (int i = 0; i < col; i++) {
cout << "-";
}
cout << "+" << endl << endl;
}
system("pause");
return 0;
}