- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- int n;
- cout<<"please input the number"<<endl;
- cin>>n;
- while (n--)
- {
- int b[10];
- double a=1;
- double sum=0;
- int i=0;
- int z,d;
- string s;
- int c;
- for(c=0;c<=9;c++)
- {
- b[c]=0;
- }
- cout<<"please input the string"<<endl;
- cin>>s;
- while (i <= s.length() - 1)
- {
- for(z=0;z<=9;z++)
- {
- d=z+48;
- if(s[i]==d)
- {
- b[z]++;
- }
- }
- i++;
- }
- for(c=0;c<=9;c++)
- {
- cout<<c<<"="<<b[c]<<endl;
- }
- }
- return 0;
- }
算法竞赛入门经典3.3 数数字UVa1225
最新推荐文章于 2019-07-18 14:45:02 发布