首页 > 学院 > 开发设计 > 正文

PAT1021.个位数统计

2019-11-08 19:30:39
字体:
来源:转载
供稿:网友
#include <iostream>using namespace std;int main(){	char num[1000];	cin >> num;	int i = 0;	int count[10] = {};	while (num[i] != '/0')	{		int c = num[i++] -'0';		++count[c];	}	for(int i=0;i<10;++i)	{		if(count[i] != 0)			cout<<i<<":"<<count[i]<<endl;	}	return 0;}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表