题意:输入宽和高,输出一个矩形,并且每次输出完最后要加一个空行
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67/* * *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内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复