个位数统计
我的代码:
#include<iostream>
#include<cstring>
using namespace std;
int x[10];
int main()
{
char *y=new char[1000];
cin>>y;
int i=0;
while(y[i]!=0)
{
x[y[i]-48]++;
i++;
};
i=0;
for(;i<10;i++)
if(x[i]!=0)
cout<<i<<":"<<x[i]<<endl;
return 0;
}

浙公网安备 33010602011771号