求助没输入完就执行完成了
查看原帖
求助没输入完就执行完成了
654928
Zjc20120331楼主2023/1/8 17:06

rt

#include <bits/stdc++.h>
using namespace std;

int sum[30];

int main(){
	int maxn = 0;
	for (int i = 1; i <= 4; i++){
		string s;
		getline(cin, s);
		for (int j = 0; j < s.size(); j++){
			if ('A' <= s[j] && s[j] <= 'Z'){
				maxn = max(maxn, ++sum[s[i]-'A']);
			}
		}
	}
	for (int i = maxn; i >= 1; i--){
		for (int j = 0; j <= 25; j++){
			if (sum[j] > i){
				cout << "* ";
			}else{
				cout << "  ";
			}
		}
		cout << endl;
	}
	for (char i = 'A'; i <= 'Z'; i++){//ASCII码的妙用 
		cout << i << " ";
	}
	return 0;
}
2023/1/8 17:06
加载中...