/*从键盘任意输入5个学生的姓名,编程找出并输出按字典顺序排在最前面的学生姓名 。
等价于求最小字符串 。*/
#include<stdio.h>
#include<string.h>
#define M 100
void main()
{
char ch[M],min[M];//声明变量
int i,j;
printf("请输入5个学生的名字:");
gets(ch);
strcpy(min,ch);
for(i=1;i<5;i++)
{
gets(ch);
if(strcmp(min,ch)<0)
{
strcpy(min,ch);
}
}
printf("The min is:");
puts(min);
}
找出姓名排在前面的同学.c : error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format