anaoai @ 2021-11-10 17:53:35
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
int lon=0;
string x;
cin>>n;
char _mo[5][500];
for(int i=0;i<n;i++){
cin>>x[i];
}
for(int i=0;i<n;i++){
int a;
a=x[i]-'0';
if(a==0){
_mo[0][lon]=_mo[1][lon]=_mo[2][lon]=_mo[3][lon]=_mo[4][lon]='X';
_mo[1][lon+1]=_mo=[2][lon+1]=_mo[3][lon+1]='.';
_mo[0][lon+1]=_mo[4][lon+1]='X';
_mo[0][lon+2]=_mo[1][lon+2]=_mo[2][lon+2]=_mo[3][lon+2]=_mo[4][lon+2]='X';
}if(a==1){
_mo[0][lon]=_mo[1][lon]=_mo[2][lon]=_mo[3][lon]=_mo[4][lon]='.';
_mo[0][lon+1]=_mo[1][lon+1]=_mo[2][lon+1]=_mo[3][lon+1]=_mo[4][lon+1]='.';
_mo[0][lon+2]=_mo[1][lon+2]=_mo[2][lon+2]=_mo[3][lon+2]=_mo[4][lon+2]='X';
}if(a==2){
_mo[0][lon]=_mo[0][lon+1]=_mo[0][lon+2]='X';
_mo[1][lon]=_mo[1][lon+1]='.';_mo[1][lon+2]='X';
_mo[2][lon]=_mo[2][lon+1]=_mo[2][lon+2]='X';
_mo[3][lon+1]=_mo[3][lon+2]='.';_mo[3][lon]='X';
_mo[4][lon]=_mo[4][lon+1]=_mo[4][lon+2]='X';
}if(a==3){
_mo[0][lon+2]=_mo[1][lon+2]=_mo[2][lon+2]=_mo[3][lon+2]=_mo[4][lon+2]='X';
_mo[0][lon]=_mo[0][lon+1]=_mo[2][lon]=_mo[2][lon+1]=_mo[4][lon]=_mo[4][lon+1]='X';
_mo[1][lon]=_mo[1][lon+1]=_mo[3][lon]=_mo[3][lon+1]='.';
}if(a==4){
_mo[0][lon+2]=_mo[1][lon+2]=_mo[2][lon+2]=_mo[3][lon+2]=_mo[4][lon+2]='X';
_mo[0][lon]=_mo[1][lon]=_mo[2][lon]=_mo[2][lon+1]='X';
_mo[0][lon+1]=_mo[1][lon+1]=_mo[3][lon]=_mo[4][lon]=_mo[3][lon+1]=_mo[4][lon+1]='.';
}if(a==5){
_mo[0][lon]=_mo[0][lon+1]=_mo[0][lon+2]='X';
_mo[1][lon+1]=_mo[1][lon+2]='.';_mo[1][lon]='X';
_mo[2][lon]=_mo[2][lon+1]=_mo[2][lon+2]='X';
_mo[3][lon]=_mo[3][lon+1]='.';_mo[3][lon+2]='X';
_mo[4][lon]=_mo[4][lon+1]=_mo[4][lon+2]='X';
}if(a==6){
_mo[0][lon]=_mo[0][lon+1]=_mo[0][lon+2]='X';
_mo[1][lon+1]=_mo[1][lon+2]='.';_mo[1][lon]='X';
_mo[2][lon]=_mo[2][lon+1]=_mo[2][lon+2]='X';
_mo[3][lon+1]='.';_mo[3][lon]=_mo[3][lon+2]='X';
_mo[4][lon]=_mo[4][lon+1]=_mo[4][lon+2]='X';
}if(a==7){
_mo[0][lon+2]=_mo[1][lon+2]=_mo[2][lon+2]=_mo[3][lon+2]=_mo[4][lon+2]='X';
_mo[0][lon]=_mo[0][lon+1]='X';
_mo[1][lon]=_mo[2][lon]=_mo[3][lon]=_mo[4][lon]='.';
_mo[1][lon+1]=_mo[2][lon+1]=_mo[3][lon+1]=_mo[4][lon+1]='.';
}if(a==8){
_mo[0][lon]=_mo[0][lon+1]=_mo[0][lon+2]='X';
_mo[1][lon+1]='.';_mo[1][lon]=_mo[1][lon+2]='X';
_mo[2][lon]=_mo[2][lon+1]=_mo[2][lon+2]='X';
_mo[3][lon+1]='.';_mo[3][lon]=_mo[3][lon+2]='X';
_mo[4][lon]=_mo[4][lon+1]=_mo[4][lon+2]='X';
}if(a==9){
_mo[0][lon]=_mo[0][lon+1]=_mo[0][lon+2]='X';
_mo[1][lon+1]='.';_mo[1][lon]=_mo[1][lon+2]='X';
_mo[2][lon]=_mo[2][lon+1]=_mo[2][lon+2]='X';
_mo[3][lon]=_mo[3][lon+1]='.';_mo[3][lon+2]='X';
_mo[4][lon]=_mo[4][lon+1]=_mo[4][lon+2]='X';
}
lon=lon+2;
if(i!=n-1){
_mo[0][lon+1]=_mo[1][lon+1]=_mo[2][lon+1]=_mo[3][lon+1]=_mo[4][lon+1]='.';
lon++;
}
}
for(int aa=0;aa<5;aa++){
for(int bb=0;bb<lon;bb++){
cout<<_mo[aa][bb];
}
cout<<endl;
}
return 0;
}
报错:
/tmp/compiler_aguweqz7/src: 在函数‘int main()’中:
/tmp/compiler_aguweqz7/src:17:23: 错误:expected identifier before numeric constant
_mo[1][lon+1]=_mo=[2][lon+1]=_mo[3][lon+1]='.';
^
/tmp/compiler_aguweqz7/src: 在 lambda 函数中:
/tmp/compiler_aguweqz7/src:17:25: 错误:expected ‘{’ before ‘[’ token
_mo[1][lon+1]=_mo=[2][lon+1]=_mo[3][lon+1]='.';
^
/tmp/compiler_aguweqz7/src: 在函数‘int main()’中:
/tmp/compiler_aguweqz7/src:17:25: 错误:no match for ‘operator[]’ (operand types are ‘main()::<lambda()>’ and ‘int’)
by StillEmpty @ 2021-11-10 17:56:26
_mo[1][lon+1]=_mo=[2][lon+1]=_mo[3][lon+1]='.';
卡姿兰大眼睛
...=_mo=[2][lon+1]...
by anaoai @ 2021-11-10 17:59:47
@Kobayashi 感谢大佬我是傻逼