/*。
*Copyright(c)2014,烟台大学计算机学院
*All right reserved,
*文件名:test.cpp
*作者:biyutang
*完成日期:2014年11月23日
*版本号:v1.0
*
问题描述:
*输入描述:输入x
*程序输出:输出Y
*/
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
char str[50];
int a[10]= {0};
int i;
cout<<"输入字符串:";
gets(str);
for(i=0; str[i]!='\0'; i++)
{
a[str[i]-'0']++;
}
cout<<"\""<<str<<"\" 中各数字出现的次数是: "<<endl;
for(i=0; i<10; ++i)
cout<<i<<"......"<<a[i]<<endl;
return 0;
}
运行结果: