解题思路:
注意事项:
参考代码:
#include<stdio.h> void Paint(unsigned long a,int i) { char zeno[5][4]={"***","* *","* *","* *","***"}; char one[5][4]={" *"," *"," *"," *"," *"}; char two[5][4]={"***"," *","***","* ","***"}; char three[5][4]={"***"," *","***"," *","***"}; char four[5][4]={"* *","* *","***"," *"," *"}; char five[5][4]={"***","* ","***"," *","***"}; char six[5][4]={"***","* ","***","* *","***"}; char seven[5][4]={"***"," *"," *"," *"," *"}; char eight[5][4]={"***","* *","***","* *","***"}; char nine[5][4]={"***","* *","***"," *","***"}; switch(a) { case 0: printf("%s",zeno[i]); break; case 1: printf("%s",one[i]); break; case 2: printf("%s",two[i]); break; case 3: printf("%s",three[i]); break; case 4: printf("%s",four[i]); break; case 5: printf("%s",five[i]); break; case 6: printf("%s",six[i]); break; case 7: printf("%s",seven[i]); break; case 8: printf("%s",eight[i]); break; case 9: printf("%s",nine[i]); break; } } int main() { unsigned long n; int N[20],i,j,m,flag; char zeno[5][4]={"***","* *","* *","* *","***"}; while(scanf("%ul",&n)!=EOF) { flag=0; if(n==0)//别忘了0 { flag=1; for(i=0;i<5;i++) { printf("%s\n",zeno[i]); } } i=0; while(n!=0)//求出每一位数字 { N[i]=n%10; n=n/10; i++; } m=i; for(i=0;i<5;i++) { for(j=m-1;j>=0;j--) { Paint(N[j],i); if(j!=0)//数字和数字之间空一列 printf(" "); } if(flag==0) printf("\n"); } } return 0; }
0.0分
0 人评分
一个简单易懂的代码浏览:1188 |
C语言程序设计教程(第三版)课后习题6.7 (C++代码)浏览:1159 |
Minesweeper (C语言代码)浏览:855 |
点我有惊喜!你懂得!浏览:4111 |
C语言训练-斐波纳契数列 (C语言代码)浏览:826 |
简单的a+b (C语言代码)浏览:676 |
C语言程序设计教程(第三版)课后习题8.3 (Java代码)浏览:1402 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:580 |
WU-C语言程序设计教程(第三版)课后习题11.11 (C++代码)(想学链表的可以看看)浏览:1463 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:687 |