@[rsrm123](/user/871166)
您这 `while(true)` 不超时才怪,改成这样就好:
```cpp
#include<stdio.h>
#include<stdbool.h>
char temp;
int jishu[30] = {0},i,j,control = 0,max;
int main(){
while(~scanf("%c",&temp)){
if(temp == '\n'){
control++;
if(control == 4){
break;
}
continue;
}
if((temp>='A')&&(temp<='Z')){
jishu[temp-64]++;
}
}
for(i = 1;i<=26;i++){
if(i == 1){
max = jishu[i];
}else{
if(max<jishu[i]){
max = jishu[i];
}
}
}
for(j = max;j>=1;j--){
for(i = 1;i<=26;i++){
if(i == 1){
if(jishu[i] == j){
jishu[i]--;
printf("*");
}else{
printf(" ");
}
}else{
if(jishu[i] == j){
jishu[i]--;
printf(" *");
}else{
printf(" ");
}
}
}
printf("\n");
}
for(i = 1;i<=26;i++){
if(i == 1){
printf("%c",i+64);
}else{
printf(" %c",i+64);
}
}
return 0;
}
```
~~不要脸的求个关注,谢谢~~
by tbdsh @ 2022-12-27 20:13:50
@[tianbiandeshenghuo11](/user/752485) 已关注大佬!!!啊?不是当最后一个回车敲进去,就结束了嘛,是我理解有问题嘛
by rsrm123 @ 2022-12-27 20:22:13
@[rsrm123](/user/871166)
不是,当存在 `while(x)` ($x\ge1$ 或为 `true`) 没有 `return 0;` 或 `break`时将无法结束程序。
by tbdsh @ 2022-12-27 21:41:40