设为首页收藏本站

嘻皮客娱乐学习网

 找回密码
 中文注册
搜索
打印 上一主题 下一主题
开启左侧

[面试题库] 统计每一学生的平均成绩

[复制链接]
跳转到指定楼层
楼主
发表于 2014-11-30 10:11:36 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
已知文件中存有10 个学生的数学、政治、和英语三门课的成绩,试统计每一学生的平均成绩,并存入该文件中。
解:#include
struct student{  int number;
char cname[10];
int shuxue;
int zhengzhi;
int yingyu;
double ave;};
main()
{
FILE   *fp;
struct student s[10];
int size;
int i;
size=sizeof(struct student);
if((fp=fopen(“student”,”ab+”))==NULL)
{
printf(“cannot open the file!”);
exit(0);
}
for(i=0;i
回复

使用道具 举报

小黑屋|手机版|嘻皮客网 ( 京ICP备10218169号|京公网安备11010802013797  

GMT+8, 2024-5-16 12:25 , Processed in 0.167432 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表