看一下吧,我也是新手。我调试了,你看看,
#include <stdio.h>
void main()
{
int m,i;
int p[10];
printf("请输入一个整数m:");
scanf("%d",&m);
for(i=0;m!=0;i++)
{
p[i]=m%10;
m=m/10;
printf("%d ",p[i]);
}
printf("\n");
for(;i>=0;i--)
{switch (p[i])
{
case 0:printf("0000");break;
case 1: printf("0001");break;
case 2: printf("0010");break;
case 3: printf("0011");break;
case 4: printf("0100");break;
case 5: printf("0101");break;
case 6: printf("0110");break;
case 7: printf("0111");break;
case 8: printf("1000");break;
case 9: printf("1001");break;
default: ;
}
}
printf("\n");
}
温馨提示:答案为网友推荐,仅供参考