关键是:
#include
#include
char buf;
int n,dig,i;
printf(\"请输入一行数字:\");
scanf(\"%d\",n);
sprintf(buf,\"%d\",n);
i=0;
while(buf[i]!=\'\\0\')
{
dig=buf[i];
switch dig
case 0: a[0]++;
break;
case 1: a[1]++;
break:
......
default: break;
i++;
}
{
dig=buf[i];
switch dig
case 0: a[0]++;
break;
case 1: a[1]++;
break:
......
default: break;
i++;
}