字符输出不对,没空格
查看原帖
字符输出不对,没空格
534757
一实李逸睿楼主2021/10/5 08:15
#include<bits/stdc++.h>
using namespace std;
int h[67];
int main()
{
	int math=0;
	int len;
	char w[288];
	for(int i=0;i<4;i++){//最大输4次 
		gets(w);//输入 
		len=strlen(w);//记录长度 
		for(int i=0;i<len;i++){
			if(w[i]>='A'&&w[i]<='Z'){//存入 
				h[w[i]-'A']++;
				
				
			}
			
		}
		
	}
	for(int i=0;i<26;i++){
		if(h[i]>math){
			math=max(h[i],math); 
			
		}
		
		
	}
	
	for(int j=math;j>0;j--){
		for(int i=0;i<26;i++){
			if(h[i]>=j){
				cout<<"*";
				
			}
			
			else{
				cout<<" ";
			}
			
		}
		
		cout<<endl;
		
	}
	for(int i=0;i<26;i++){
		printf("%c",i+'A');
		
	}
	return 0;
}
2021/10/5 08:15
加载中...