c语言编写的简单学籍管理系统,简易学籍管理系统(C语言版).doc

简易学籍管理系统(C语言版)

//功能界面

#include

#include

#include

struct STUDENT

{

int num;

char name[64];

double elec; /*首先定义全局结构体变量*/

double exepe;

double required;

double Sum;

};

STUDENT stu[10000];

void menu() /*显示菜单栏,将提示用户可进行的操作*/

{

printf("|----------------STUDENT-----------------|\n");

printf("| 0.exit(显示已有信息) |\n");

printf("| 1.input record(录入信息) |\n");

printf("| 2.search(查询信息) |\n");

printf("| 3.delete(删除相关信息) |\n");

printf("| 4.modify(修改相关信息) |\n");

printf("| 5.insert(插入相关信息) |\n");

printf("| 6.order(按照总分排序) |\n");

printf("| 7.total(统计保存的信息单元数) |\n");

printf("|----------------------------------------|\n\n");

}

void show() /*显示已有的信息*/

{

FILE *fp;

char filename[64];

int m=0;

int i;

printf("please the filename:");//输入文件名,在这里选择文件名的动态输入

scanf("%s",filename);

fp=fopen(filename,"rb"); //采取可读模式。

if(fp==NULL)

{

printf("open error\n"); //无法读出,提示错误

exit(0);

}

while(!feof(fp))

{

if(fread(&stu[m],sizeof(STUDENT),1,fp)==1)

{ //查询保存数目

m++;

}

}

if(m==0)

{

printf("No record\n"); //为0则表示没有记录

exit(0);

}

for(i=0;i

{

printf("num:");

printf("%d\n",stu[i].num);

printf("name:");

printf("%s\n",stu[i].name);

printf("elec:");

printf("%lf\n",stu[i].elec);

printf("exepe:");

printf("%lf\n",stu[i].exepe);

printf("required:");

printf("%lf\n",stu[i].required);

printf("Sum:");

printf("%lf\n",stu[i].Sum);

printf("\n");

printf("\n");

}

fclose(fp); //关闭文件

}

void in() /*信息录入*/

{

FILE *fp;

char filename[64];

char ch[10];

double r_elec;

double r_exepe;

double r_required;

printf("please input the filename:");

scanf("%s",filename);

int m=0;

int i;

fp=fopen(filename,"rb");

if(fp==NULL)

{

printf("open error\n");

exit(0);

}

while(!feof(fp)) //查询保存数目

{

if(fread(&stu[m],sizeof(STUDENT),1,fp)==1)

{

m++;

}

}

fclose(fp); //关闭文件

if(m==0)

{

printf("No record\

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值