题目
用输出你的学号对应的八位数(每位数大小为55,每个数之间距离三个空格)
例如
输入12345678输出:
代码
#include<stdio.h>
int main(){
char input[8];
int i,j;
char *line[5] = {
"*",
"* ",
" *",
"* *",
"*****"
};
char *chr0[5]={line[4],line[3],line[3],line[3],line[4]};
char *chr1[5]={line[0],line[0],line[0],line[0],line[0]};
char *chr2[5]={line[4],line[2],line[4],line[1],line[4]};
char *chr3[5]={line[4],line[2],line[4],line[2],line[4]};
char *chr4[5]={line[3],line[3],line[4],line[2],line[2]};
char *chr5[5]={line[4],line[1],line[4],line[2],line[4]};
char *chr6[5]={line[4],line[1],line[4],line[3],line[4]};
char *chr7[5]={line[4],line[2],line[2],line[2],line[2]};
char *chr8[5]={line[4],line[3],line[4],line[3],line[4]};
char *chr9[5]={line[4],line[3],line[4],line[2],line[2]};
scanf("%s",input);
for(j=0;j<5;j++){
for(i=0;i<8;i++){
switch(input[i]){
case '1':
printf("%s ",chr1[j]);
break;
case '2':
printf("%s ",chr2[j]);
break;
case '3':
printf("%s ",chr3[j]);
break;
case '4':
printf("%s ",chr4[j]);
break;
case '5':
printf("%s ",chr5[j]);
break;
case '6':
printf("%s ",chr6[j]);
break;
case '7':
printf("%s ",chr7[j]);
break;
case '8':
printf("%s ",chr8[j]);
break;
case '9':
printf("%s ",chr9[j]);
break;
case '0':
printf("%s ",chr0[j]);
break;
}
}
printf("\b\b\b\n");
}
return 0;
}
标签:输出,int,C语言,char,input,line
From: https://www.cnblogs.com/Shin404/p/16902640.html