学生综合测评系统方案

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

# include

# include "stdlib.h"

# include "string.h"

#include

struct student *Read();

void save(struct student *head);

void sinput(struct student *p);

struct student *input();

void paixu_num(struct student *head);

struct student *insert();

struct student *alter();

struct student *del();

void find_num(struct student *phead);

void find_name(struct student *phead);

void output();

void min_student(struct student *phead);

void max_student(struct student *phead);

void ave_student(struct student *phead);

void every_student(struct student *phead);

void score_paixu(struct student *head);

void help();

void tj_menu(struct student *head);

void find_menu(struct student *head);

void menu();

struct student{//定义学生信息结构数组,用于学生信息输入 char number[13];

char name[13];

char sex[4];

char adds[15];

char phone[14];

char qq[14];

float chinese,math,english,txhp,pinde,teacher;

int zcmc,ksmc;

double ave,zc;

struct student *next;

};

#define Len sizeof(struct student)

int len; //链表长度

int a=0,b=0,c=0,d=0,e=0;//用来存放成绩各阶的人数

char stu[10];

struct student *Read() {//读取数据文件保存到链表中,返回指向此链表头指针struct student *head=NULL;

struct student *p1, *p2;

FILE *fp;

cout<<"请输入你要打开的文件(.dat)"<

cin>>stu;

if((fp=fopen(stu,"rb+"))==NULL)

{

cout<<"打开文件出错!"<

exit(0);

}

while(!feof(fp)) {

if( (p1=(struct student*)malloc(Len))==NULL )

{

cout<<"内存申请出错"<

fclose(fp);

exit(0);

}

if(fread(p1,Len,1,fp)!=1)

{

free(p1);

break;

}

if(head==NULL)

head=p2=p1;

else

{

p2->next=p1;

p2=p1;

}

}

fclose(fp);

return head;

}

void save(struct student *head){//数据存盘

FILE *fp;

struct student *p;

p=head;

cout<<"请输入你要存进去的文件(.dat)"<

cin>>stu;

if((fp = fopen(stu, "wb"))==NULL)

{

cout<<"无法打开文件!"<

system("pause");

menu();

}

while(p)

{

if(fwrite(p,Len,1,fp)!=1)

{

cout<<"写入数据出错"<

fclose(fp);

return;

}

else

p=p->next;

}

cout<<"数据存入成功!请按任意键继续!"<

getchar();

fclose(fp);

}

//单次输入

void sinput(struct student *p)

{

cout<<"请输入学号:"<

cin>>p->number;

cout<<"请输入姓名: "<

cin>>p->name;

cout<<"请输入性别: "<

cin>>p->sex;

cout<<"请输入家庭住址: "<

cin>>p->adds;

cout<<"请输入联系电话: "<

cin>>p->phone;

cout<<"请输入qq: "<

cin>>p->qq;

cout<<"请输入语文成绩:"<

cin>>p->chinese;

if(p->chinese>100||p->chinese<0)

相关文档
最新文档