为什么最后没有输出啊

#include <stdio.h>

int main()
{
    char n;
        scanf("%c",&n);
    
    int max=0;
    int num[26]={0};
    while(n)
    {
        if(n>='A'&&n<='z')
        {
            if(n>='a'&&n<='z')
            {
                num[n-'a']++;
                if(num[n-'a']>max)
                 {
                     max=num[n-'a'];
                 }
            }
            else
            {
                num[n-'A']++;
                if(num[n-'A']>max)
                {
                    max=num[n-'A'];
                }
            }
        }
        else
        {
            scanf("%c",&n);
            continue;
        }
        scanf("%c",&n);
    }
    char a[100][26]={'\0'};
    int j=0;
    int i=0;
    while(j<26)
    {
        int k=num[i];
        while(k>=0)
        {
            a[j][max-k]='*';
            k--;
        }
        j++;
    }
    for(i=0;i<26;i++)
    {
        for (j=0;j<max;j++)
        {
            if(a[i][j]=='\0')
            {
                printf(" ");
                
            }
            else 
            {
                printf("%c",a[i][j]);
            }
        }
        
    }
    printf("\n");
    for(i=0;i<26;i++)
    {
        if(i==0)
        {
            printf("A");
        }
        else
        {
            printf(" %c",i+'A');
        }
    }
}

你要做的就是对一篇文章的字母进行统计。 而文章是由好多行字母,空格,标点组成的每行不会超过72个字符,请打印一个统计直方图来统计每个字母出现的次数 (不统计空行,数字,标点)。

Input

输入一份郑薇的甜言蜜语,只含有大小写字符,空格,标点。

Output

打印这一份甜蜜的统计图,具体如样例(最后不要空行)。

Sample Input

Amazing grace! How sweet the sound! That saved a wretch like me! I once was lost but now I am found, Was blind but now I see.

Sample Output

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值