You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.7 KiB

2 years ago
#include <bits/stdc++.h>
using namespace std;
string a[5] =
{"XXX...X.XXX.XXX.X.X.XXX.XXX.XXX.XXX.XXX",
"X.X...X...X...X.X.X.X...X.....X.X.X.X.X",
"X.X...X.XXX.XXX.XXX.XXX.XXX...X.XXX.XXX",
"X.X...X.X.....X...X...X.X.X...X.X.X...X",
"XXX...X.XXX.XXX...X.XXX.XXX...X.XXX.XXX"
};
int main() {
//子任务1打印数字0
for (int i = 0; i <= 4; i++) {
for (int j = 0; j < 3; j++)
cout << a[i][j];
cout << endl;
}
//子任务2打印数字1
for (int i = 0; i <= 4; i++) {
for (int j = 4; j <= 6; j++)
cout << a[i][j];
cout << endl;
}
//子任务3打印数字2
for (int i = 0; i <= 4; i++) {
for (int j = 36; j < 36 + 3; j++)
cout << a[i][j];
cout << endl;
}/*
//小结如果打印数字x,首先需要知道它对应的数字值是几,比如'5'我们需要数字5
//'5'-'0'=5
//有了5以后就是一个数字四个宽度5之前有01234所以共5个5*4=20
//数字5就是从20开始来三个然后添加一个.
for (int i = 0; i <= 4; i++) {
for (int j = 20; j < 20 + 3; j++)
cout << a[i][j];
cout << endl;
}
//最后一个问题,我们不能一个个的打印数字,这样就会造成数字不是横向排列,成了竖的!
//所以,我们需要按 “行-数字-列”这样三层循环的方式打印!
//说白了就是第一行的话我们要输出12345..的第一行内容,共三列,
// 换行后再输出12345..的第二行内容,共三列,以此类推。
*/
return 0;
}