我是靠谱客的博主 美满墨镜,这篇文章主要介绍hdu_problem_2052_Picture,现在分享给大家,希望可以做个参考。

题意:输入宽和高,输出一个矩形,并且每次输出完最后要加一个空行

/*
*
*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;
}

最后

以上就是美满墨镜最近收集整理的关于hdu_problem_2052_Picture的全部内容,更多相关hdu_problem_2052_Picture内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(137)

评论列表共有 0 条评论

立即
投稿
返回
顶部