回复 20楼 吴小君
恩,你这个开头#include <math.h>用的是什么?还有这边 b=a/pow(10,c);
a=a-b*pow(10,c);
c--;
是什么意思? 我没学过
#include <stdio.h> #include <stdlib.h> #include <string.h> char a[][60]={ "ooo o ooo ooo o o ooo ooo ooo ooo ooo", "o o o o o o o o o o o o o o", "o o o ooo ooo ooo ooo ooo o ooo ooo", "o o o o o o o o o o o o o", "ooo o ooo ooo o ooo ooo o ooo o"}; int i,j,k,len; char s[10]; int main() { scanf("%s",s); len=strlen(s); for (i=0; i<5; i++) { for (k=0; k<len; k++) { j=s[k]-'0'; printf("%c%c%c",a[i][6*j],a[i][6*j+1],a[i][6*j+2]); if (k!=len-1) printf(" "); } printf("\n"); } return 0; }
#include <stdio.h> void print(char *p) { char a[5][30]= {{'0','0','0',' ','0',' ','0','0','0','0','0','0','0',' ','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'} , {'0',' ','0',' ','0',' ',' ',' ','0',' ',' ','0','0',' ','0','0',' ',' ','0',' ',' ',' ',' ','0','0',' ','0','0',' ','0'} , {'0',' ','0',' ','0',' ','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0',' ',' ','0','0','0','0','0','0','0'} , {'0',' ','0',' ','0',' ','0',' ',' ',' ',' ','0',' ',' ','0',' ',' ','0','0',' ','0',' ',' ','0','0',' ','0',' ',' ','0'} , {'0','0','0',' ','0',' ','0','0','0','0','0','0',' ',' ','0','0','0','0','0','0','0',' ',' ','0','0','0','0','0','0','0'}}; int Num, i; for(i=0; i<5; i++) { int k=0; while(*(p+k) !='\0') { Num = *(p+k) - '0'; for(int j=3*Num; j<3*Num+3; j++) { printf("%c",a[i][j]); } printf(" "); k++; } printf("\n"); } } int main(void) { char a[20]; printf("请输入整数:\n"); gets(a); print(a); return 0; }