输入5个字符串(中文或英文),找出其中的最大串(ASCII码值最大的,用strcmp函数比较.打擂台算法).

不要用指针,还木有学、、、

//#include "stdafx.h"//vc++6.0加上这一行.
#include "stdio.h"
#include "string.h"
void main(void){
char a[5][20],b[20],i;
printf("Type 5 strings...\n");
for(i=0;i<5;scanf("%s",(a[i++])));
for(strcpy(b,a[0]),i=1;i<5;i++)
if(strcmp(b,a[i])<0) strcpy(b,a[i]);
printf("The max str is %s.\n",b);
}
温馨提示:答案为网友推荐,仅供参考
相似回答