题目要求如下
1,使用二维阵列去储存值
2,让阵列的大小是20*20,(type char arr[20][20]).这个画布的大小是固定的,所有的值都储存在这个画布当中。
3,这个程序可以让用户选择画出的图形形状。
4,画出一个矩形,让用户输入行数和列数以及ASCII 字符和矩形在画布中的位置的位置。
5,确保产生的图形是由用户输入的ASCII字符组成的。("*", "$", Anything on the keyboard!)。
示例1如下
1.Type S to draw a rectangle
2.Type T to draw a Triangle
3.Type D to Display
4.Type Q to Quit
S
Enter Height
3
Enter Width
4
Enter character
$
Enter location on canvas (x and y coordinate)
3
3
1.Type S to draw a rectangle
2.Type T to draw a Triangle
3.Type D to Display
4.Type Q to Quit
D
$$$$
$$$$
$$$$
1.Type S to draw a rectangle
2.Type T to draw a Triangle
3.Type D to Display
4.Type Q to Quit
S
Enter Height
5
Enter Width
5
Enter character
@
Enter location on canvas (x and y coordinate)
6
6
1.Type S to draw a rectangle
2.Type T to draw a Triangle
3.Type D to Display
4.Type Q to Quit
D
$$$$
$$$$
$$$$
@@@@@
@@@@@
@@@@@
@@@@@
@@@@@
-------------------------------------------------------------------------------------------------------------
示例2如下
1.Type S to draw a rectangle
2.Type T to draw a Triangle
3.Type D to Display
4.Type Q to Quit
S
Enter Height
3
Enter Width
3
Enter character
$
Enter location on canvas (x and y coordinate)
2
3
1.Type S to draw a rectangle
2.Type T to draw a Triangle
3.Type D to Display
4.Type Q to Quit
S
Enter Height
5
Enter Width
6
Enter character
#
Enter location on canvas (x and y coordinate)
2
5
1.Type S to draw a rectangle
2.Type T to draw a Triangle
3.Type D to Display
4.Type Q to Quit
D
$$######
$$######
$$######
######
######
1.Type S to draw a rectangle
2.Type T to draw a Triangle
3.Type D to Display
4.Type Q to Quit
S
Enter Height
5
Enter Width
5
Enter character