Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1947357
  • 博文数量: 424
  • 博客积分: 1291
  • 博客等级: 中尉
  • 技术积分: 2682
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-13 01:34
个人简介

linux oracle 网络安全 编程

文章分类

全部博文(424)

文章存档

2016年(22)

2015年(53)

2014年(57)

2013年(242)

2012年(50)

分类: C/C++

2012-12-21 20:33:36

#include
#define N 3
 struct Student
 {
  long num;
  char name[20];
  float score[3];
  double aver;
 };
 int main ()
 {
  void input (struct Student stu[]);
  struct Student max(struct Student stu[]);
  void print(struct Student stu[]);
  struct Student stu[N],*p=stu;
  input(p);
  print(max(p));
  return 0;
 }
     void input(struct Student stu[])
  {
    int i;
    printf("请输入各学生的信息:学号、姓名、三门功课:\n");
     for(i=0;i     {
      scanf("%ld %s %f %f %f",&stu[i].num,&stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
      stu[i].aver=(stu[i].score[0]+stu[i].score[1]+stu[i].score[2])/3.0;
     }
     }
  struct Student max(struct Student stu[])
  {
   int m=0,i;
   for(i=0;i   {
    if(stu[i].aver>stu[m].aver)
     m=i;
    return stu[m];
   }
  }

  void print(struct Student stu)
  {
   printf("\n最高成绩的学生是:\n");
   printf("学号:%d\n姓名:%s\n三门成绩:%5.1f,%5.1f,%5.1f\n平均成绩:%6.2f\n",stu.num,stu.name,stu.score[0],stu.score[1],stu.score[2],stu.aver);
  }
 
问题:
 
Compiling...
day19.c
E:\cprogram\day19\day19.c(17) : error C2115: 'function' : incompatible types
E:\cprogram\day19\day19.c(17) : warning C4024: 'print' : different types for formal and actual parameter 1
E:\cprogram\day19\day19.c(27) : error C2018: unknown character '0xa3'
E:\cprogram\day19\day19.c(27) : error C2018: unknown character '0xac'
E:\cprogram\day19\day19.c(27) : error C2296: '&' : illegal, left operand has type 'long *'
E:\cprogram\day19\day19.c(27) : error C2297: '&' : illegal, right operand has type 'char [20]'
E:\cprogram\day19\day19.c(45) : warning C4028: formal parameter 1 different from declaration
Error executing cl.exe.
day19.obj - 5 error(s), 2 warning(s)
阅读(826) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~