sing11 @ 2023-07-14 16:47:57
#include<iostream>
using namespace std;
main()
{
int n,k,i,j;
int a[101];
string ans[5];
scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&a[i]);//数字
k=0;
while(k<n){
switch(a[k]){
case 0:ans[0] += "XXX";ans[4] += "XXX";
ans[1] += "X.X";ans[2] += "X.X";ans[3] += "X.X";break;
case 1:ans[0] += "..X";ans[4] += "..X";
ans[1] += "..X";ans[2] += "..X";ans[3] += "..X";break;
case 2:ans[0] += "XXX";ans[4] += "XXX";
ans[1] += "..X";ans[2] += "XXX";ans[3] += "X..";break;
case 3: ans[0] += "XXX";ans[4] += "XXX";
ans[1] += "..X";ans[2] += "XXX";ans[3] += "..X";break;
case 4:ans[0] += "X.X";ans[4] += "..X";
ans[1] += "X.X";ans[2] += "XXX";ans[3] += "..X";break;
case 5: ans[0] += "XXX";ans[4] += "XXX";
ans[1] += "X..";ans[2] += "XXX";ans[3] += "..X";break;
case 6: ans[0] += "XXX";ans[4] += "XXX";
ans[1] += "X..";ans[2] += "XXX";ans[3] += "X.X";break;
case 7: ans[0] += "XXX";ans[4] += "..X";
ans[1] += "..X";ans[2] += "..X";ans[3] += "..X";break;
case 8:ans[0] += "XXX";ans[4] += "XXX";
ans[1] += "X.X";ans[2] += "XXX";ans[3] += "X.X";break;
case 9:ans[0] += "XXX";ans[4] += "XXX";
ans[1] += "X.X";ans[2] += "XXX";ans[3] += "..X";break;
}
k++;
}
for(i=0;i<n;i++){
cout<<ans[i];
printf("\n");
}
}
/*
字符串数组
s[]
*/
by sing11 @ 2023-07-14 17:23:57
@Register_int 谢谢大佬,我看懂代码了!
by sing11 @ 2023-07-15 15:55:09
为什么char a[101]放在局部变量里输出就会带上一长串乱码的中文呀