从键盘输入一行字符以回车键结束,输出其中最大字符的ASCII码

如题所述

#include<stdio.h>

int main(){
    char temp, max;
    int flag = 0;
while( (temp=getchar())!='\n'){
if(flag==0){
max = temp;
flag = 1;
}
if(temp > max)
max = temp;


printf("max=%d", max);
    return 0;
}
温馨提示:答案为网友推荐,仅供参考
相似回答