C语言数据结构 编写【学生成绩管理系统】

来源:百度知道 编辑:UC知道 时间:2024/07/10 20:40:07
现有学生成绩信息文件1(1.txt),内容如下
姓名 学号 语文 数学 英语
张明明 01 67 78 82
李成友 02 78 91 88
张辉灿 03 68 82 56
王露 04 56 45 77
陈东明 05 67 38 47
…. .. .. .. …
学生成绩信息文件2(2.txt),内容如下:
姓名 学号 语文 数学 英语
陈果 31 57 68 82
李华明 32 88 90 68
张明东 33 48 42 56
李明国 34 50 45 87
陈道亮 35 47 58 77
…. .. .. .. …
试编写一管理系统,要求如下:
1、 实现对两个文件数据进行合并,生成新文件3.txt
2、 抽取出三科成绩中有补考的学生并保存在一个新文件4.txt
3、 对合并后的文件3.txt中的数据按总分降序排序(至少采用两种排序方法实现)
4、 输入一个学生姓名后,能查找到此学生的信息并输出结果(至少采用两种查找方法实现)
5、 要求使用结构体,链或数组等实现上述要求.
做得好 加分
有急用 先谢谢大家了

#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <memory.h>
#include <string.h>

#define FILE1 "1.txt"
#define FILE2 "2.txt"
#define FILE3 "3.txt"
#define FILE4 "4.txt"
struct STUDENT
{
char name[20];
int number;
int chinese;
int math;
int english;
int total;
};
typedef STUDENT student;
int count = 0;
student *ss = NULL;

void combine2files()
{
FILE *in, *out;
student s;

out = fopen(FILE3, "w");
in = fopen(FILE1, "r");

if (!in || !out)
{
printf("can't open file(s)\n");
exit(-1);
}

while (1)
{
s.name[0] = '\0';
fscanf(in, "%s %d %d %d %d", s.name, &s.number, &s.chinese, &s.math, &s.english);

if (s.nam