****要求输入提示信息为:
"Input a string:\n"
****输出格式要求为:
"The largest character of \"%s\" is \'%c\' ,The ASCII is %d."
程序运行示例:
Input a string:↙
I am a student.
The largest character of "I am a student." is 'u' ,The ASCII is 117.↙
#include<stdio.h>
#define N 30
int main()
{
char str[N];
char max_char, temp;
int i;
printf("Input a string:\n");
gets(str);
max_char = str[0];
for(i = 0; str[i] != '\0'; i++)
{
if(str[i] > max_char)
{
max_char = str[i];
}
}
printf("The largest character of \"%s\" is \'%c\' ,The ASCII is %d.", str, max_char, max_char);
return 0;
}