UDP广播协议叫吃饭


私信TA

用户名:Mustenaka

访问量:134733

签 名:

个人博客www.mustenaka.cn

等  级
排  名 12
经  验 23712
参赛次数 8
文章发表 196
年  龄 3
在职情况 学生
学  校 Sky_box
专  业 NE

  自我简介:

欢迎光临我的博客www.mustenaka.cn,Python,C#,U3D,C/C++开发合作可以找我

解题思路:
    混用了printf和cin,所以不要解绑cin.tie,说到底还是水题
参考代码:

#include<bits/stdc++.h>
using namespace std;
int main() {
	char str;
	int str_number[26]= {0};
	while(cin>>str&&str!='#') {
		if(str!='\n'||str!=' '){
			str_number[str-'a']++;
		}
	}
	for(int i=0;i<26;i++){
		printf("%c %d\n",'a'+i,str_number[i]);
	}
	return 0;
}


 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区