jlnmgl @ 2022-02-10 17:48:16
#include<stdio.h>
int main(){
int n=0,i=0,j=0,k=0;
int a[110]={0};
scanf("%d%d",&n,&i);
while(i!=0){
j=i;
a[k]=j%10;
k=k+2;
i=i/10;}
for(j=1;j<k;j++){
a[j]='@';
j++;
}
for(i=k-2;i>=0;i--)
switch(a[i]){
case 0:printf("xxx\nx.x\nx.x\nx.x\nxxx");break;
case 1:printf("..x\n"
"..x\n"
"..x\n"
"..x\n"
"..x");break;
case 2:printf("xxx\n"
"..x\n"
"xxx\n"
"x..\n"
"xxx");break;
case 3:printf("xxx\n"
"..x\n"
"xxx\n"
"..x\n"
"xxx");break;
case 4:printf("x.x\n"
"x.x\n"
"xxx\n"
"..x\n"
"..x");break;
case 5:printf("xxx\n"
"x..\n"
"xxx\n"
"..x\n"
"xxx");break;
case 6: printf("xxx\n"
"x..\n"
"xxx\n"
"x.x\n"
"xxx");break;
case 7: printf("xxx\n"
"..x\n"
"..x\n"
"..x\n"
"..x");break;
case 8:printf("xxx\n"
"x.x\n"
"xxx\n"
"x.x\n"
"xxx");break;
case 9:printf("xxx\n"
"x.x\n"
"xxx\n"
"..x\n"
"xxx");break;
case '@':printf(".\n.\n.\n.\n.\n");}
return 0; }
by 我不是管理员 @ 2022-02-10 17:57:37
@jlnmgl 问题是什么?
by yzh_Error404 @ 2022-02-10 18:14:09
@jlnmgl 那就用if
by jlnmgl @ 2022-02-10 18:29:12
@yzh_Error404 感谢大佬!!!!
by jlnmgl @ 2022-02-10 18:38:12
#include<stdio.h>
int main(){
int n=0,i=0,j=0,k=0;
int a[110]={0};
scanf("%d%d",&n,&i);
while(i!=0){
j=i;
a[k]=j%10;
k=k+2;
i=i/10;}
for(j=1;j<k;j++){
a[j]='@';
j++;
}
for(i=k-2;i>=0;i--){
if(a[i]==0) printf("xxx\nx.x\nx.x\nx.x\nxxx");
if(a[i]==1) printf("..x\n"
"..x\n"
"..x\n"
"..x\n"
"..x");
if(a[i]==2) printf("xxx\n"
"..x\n"
"xxx\n"
"x..\n"
"xxx");
if(a[i]==3) printf("xxx\n"
"..x\n"
"xxx\n"
"..x\n"
"xxx");
if(a[i]==4) printf("x.x\n"
"x.x\n"
"xxx\n"
"..x\n"
"..x");
if(a[i]==5) printf("xxx\n"
"x..\n"
"xxx\n"
"..x\n"
"xxx");
if(a[i]==6) printf("xxx\n"
"x..\n"
"xxx\n"
"x.x\n"
"xxx");
if(a[i]==7) printf("xxx\n"
"..x\n"
"..x\n"
"..x\n"
"..x");
if(a[i]==8) printf("xxx\n"
"x.x\n"
"xxx\n"
"x.x\n"
"xxx");
if(a[i]==9) printf("xxx\n"
"x.x\n"
"xxx\n"
"..x\n"
"xxx");
if(a[i]=='@') printf(".\n.\n.\n.\n.\n");}
return 0; }
*** if 好像也不行?