-
-
请大家看看C初级程序,自己找不出来啊,!
-
发表于:
2006-12-22 16:11
4627
-
找出成程最大的那个人:
源码:
#include "stdio.h"
char *sort(int n);
struct student
{
int num;
char name[20];
float score;
};
int find(struct student *p,int n)
{
int i,temp;
float max;
for(max=p->score,i=1;i<n;i++)
{
if((p+i)->score>max)
{max=(p+i)->score;temp=i; }
}
return temp;
}
char *sort(int n)
{
n=n+1;
char *dort[]={"first","secend","third","fouth","fifth"};
return dort[n];
}
main()
{
struct student stu[4];
int i;float score;
struct student *p;
int temp=0;
for(i=0;i<4;i++)
{printf("please inpurt the %s student si date: num name score:\n",sort[i]);
scanf("%d%s%f",&stu[i].num,stu[i].name,&score);
stu[i].score=score;
}
temp=find(stu,4);
p=stu+temp;
printf("The maxnum score is:\n ");
printf("NO:%d\nname:%s\nscore%4.1f\n",p->num,p->name,p->score);
}
编译时问题:
wxpression systax in function sort
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)