C語言程序:
#include?<stdio.h>#include?<string.h>
#define?MAX?80
void?main()
{
char?arr[MAX?+?1];
char?max;
int?len;
int?i;
printf("Input?a?string:\n");
gets(arr);
max?=?'\0';
len?=?strlen(arr);
for(i=0;?i<len;?i++)
{
if(arr[i]?>?max)
{
max?=?arr[i];
}
}
printf("The?largest?character?is?\'%c\'.The?ASCII?is?%d.\n",?max,?max);
} 運行測試: