我这个程序的问题出在哪里了?

#include<stdio.h>
#define Num 10
struct data
{
float grade;
float C_grade;
char paper;
char W_stu;
char Stu_cadres;
}stu[Num];
int sort(struct data stu[],int);
int main()
{
int i,money,n;
printf("请输入学生的信息!\n");
for(i=0;i<Num;i++)
{ printf("现在输入第%d个学生的资料:\n",i+1);
printf("期末平均成绩:");
scanf("%f",&stu[i].grade);
printf("\n");
printf("班级评议成绩:");
scanf("%f",&stu[i].C_grade);
printf("\n");
printf("该学生是否曾发表过论文:");
scanf("%c",&stu[i].paper);
printf("\n");
printf("该学生是否为西部学生:");
scanf("%c",&stu[i].W_stu);
printf("\n");
printf("该学生是否为学生班干部:");
scanf("%c",&stu[i].Stu_cadres);
printf("\n");
printf("第%d个学生的资料已经输入完毕!\n",i+1);
}
printf("请输入你所要知道的学生的序列号,系统会返回其获奖学金情况!\n");
scanf("%d",&n);
switch(sort(stu[Num],n-1))
{
case 1:money=8000;
case 2:money=4000;
case 3:money=2000;
case 4:money=1000;
case 5:money=850;
}
printf("该学生所获得的奖学金为:%d\n",money);
}
int sort(struct data stu[],int i)
{

if(stu[i].grade>80 && stu[i].paper=='y') return 1;
else if(stu[i].grade>85 && stu[i].C_grade>80) return 2;
else if(stu[i].grade>90) return 3;
else if(stu[i].grade>85 && stu[i].W_stu=='y') return 4;
else if(stu[i].C_grade>80 && stu[i].Stu_cadres=='y') return 5;
}

1 条评论

  • @ 2015-03-08 18:05:06

    只需要输出题目中要求的内容就可以了,不能输出“请输入学生的信息!”这样的东西。

  • 1

信息

ID
1001
难度
5
分类
模拟 点击显示
标签
递交数
39037
已通过
12699
通过率
33%
被复制
120
上传者