c语言问题,在线等_(:_」∠)_

如题所述

第1个回答  2017-12-22

#include <stdio.h>
int main(void)
{char s[200],*p,*max;
 printf("Input a string:\n");
 gets(s);
 for(max=p=s;*p;p++)
   if(*p>*max)max=p;
 printf("The largest character of\"%s\" is \'%c\',The ASCII is %d.",s,*max,*max);
 return 0;
}

本回答被提问者和网友采纳
第2个回答  2017-12-22
#include <stdio.h>

int main() {
char s[40],mc;
int i = 1;
printf("Input s:");
gets(s);
mc = s[0];
while(s[i]) {
if(s[i]  > mc) mc = s[i];
++i;
}
printf("The largest character \"%s\" is \'%c\',The ASCII is %d\n。",s,mc,mc);
return 0;
}

相似回答