60分求助
查看原帖
60分求助
251771
Passer_A楼主2020/5/19 14:15
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char str[400],str1[100],str2[100],str3[100],str4[100];
    gets(str1);
	gets(str2);
	gets(str3);
	gets(str4);
	strcat(str,str1);
	strcat(str,str2);
	strcat(str,str3);
	strcat(str,str4);
    int l = strlen(str);
    int letter[26] = {0},maxn = 0;
    for(int i=0;i < l; i++)
    {
        if(str[i] <= 'Z' && str[i] >= 'A')
        {
            letter[str[i]-65]++;
        }
    }
    for(int i=0;i < 26; i++)
    {
        if(letter[i]>maxn)
        {
            maxn = letter[i];
        }
    }
    for(int j=maxn;j > 0; j--)
    {
        for(int i=0;i < 26; i++)
        {
            if(letter[i] < j)
            {
                cout << "  ";
            }
            else
            {
                cout << "* ";
            }
        }
        cout << endl;
    }
    cout << "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
}
2020/5/19 14:15
加载中...