[学生信息管理系统C语言怎么做]跟别人问重复了,你们难道是一个老师教的啊? 网上很多类似的,你参考下:#include#includestruct student { char name[30]; float math; float chinese; float english; float ave...+阅读
#include "stdio.h" #include #include #include struct book{ char number[21]; char shuming[30]; int shuliang; int jiage; char zhuanye[20]; char zuozhe[26]; char chubanshe[20]; char beizhu[100]; struct book *next; }; struct book *creat() /*创建链表*/ { struct book *p,*head,*end; head=end=p=(struct book *)malloc(sizeof(struct book)); printf("输入教材编号为0结束输入,每项信息都必须输入内容。\n"); do { printf("\n教材编号:"); gets(p->number); if(strcmp(p->number,"0")==0){ end->next=NULL; return head;} end=p; printf("\n教材名称:"); gets(p->shuming); printf("\n教材数量:"); scanf("%d",&p->shuliang); printf("\n教材价格:"); scanf("%d",&p->jiage); getchar(); printf("\n教材专业:"); gets(p->zhuanye); printf("\n教材作者:"); gets(p->zuozhe); printf("\n教材出版社:"); gets(p->chubanshe); printf("\n备注:"); gets(p->beizhu); p=(struct book *)malloc(sizeof(struct book)); end->next=p; }while(1); } void save(struct book *head) /*保存链表*/ {FILE *fp; struct book *p; char filename[30]; int ch; printf("请输入“文件名.后缀”:"); scanf("%s",filename); if((fp=fopen(filename,"r"))!=NULL) { printf("\n该文件已存在,是否覆盖?1,是 2,否"); scanf("%d",&ch); if(ch!=1) return; } if((fp=fopen(filename,"w"))==NULL) { printf("\n文件保存失败");getchar();return;} p=head; do{ fprintf(fp,"\n%s",p->number); fprintf(fp,"\n%s",p->shuming);; fprintf(fp,"\n%d",p->shuliang); fprintf(fp,"\n%d",p->jiage); fprintf(fp,"\n%s",p->zhuanye); fprintf(fp,"\n%s",p->zuozhe); fprintf(fp,"\n%s",p->chubanshe); fprintf(fp,"\n%s",p->beizhu); p=p->next; }while(p!=NULL); fprintf(fp," over"); printf("\n成功保存"); getchar(); getchar(); fclose(fp); } void print(struct book *head) /*输出链表*/ { struct book *p; p=head; if(p==NULL) { printf("未打开任何文件,无法显示"); getch();return;} do{ printf("\n\n教材编号:%s",p->number); printf("\n教材名称:%s",p->shuming);; printf("\n数量:%d",p->shuliang); printf("\n价格:%d",p->jiage); printf("\n专业:%s",p->zhuanye); printf("\n作者:%s",p->zuozhe); printf("\n出版社:%s",p->chubanshe); printf("\n备注:%s",p->beizhu); p=p->next; }while(p!=NULL); } struct book *openfile() /*打开文件*/ {struct book *p,*f,*head; FILE *fp; char filename[20]; printf("\n请输入路径,文件名,和后缀):"); scanf("%s",filename); if((fp=fopen(filename,"r"))==NULL){ printf("\n文件找不到,请检查是否有该文件和路径是否正确");getchar();return NULL;} head=f=p=(struct book *)malloc(sizeof(struct book)); fscanf(fp,"%s%s%d%d%s%s%s%s",p->number,p->shuming,&p->shuliang,&p->jiage,p->zhuanye,p->zuozhe,p->chubanshe,p->beizhu); while(!feof(fp)) { p=(struct book *)malloc(sizeof(struct book)); f->next=p; fscanf(fp,"%s%s%d%d%s%s%s%s",p->number,p->shuming,&p->shuliang,&p->jiage,p->zhuanye,p->zuozhe,p->chubanshe,p->beizhu); if(strcmp(p->number,"over")==0){ f->next=NULL; printf("\n文件打开成功,可以显示此信息");getchar(); return head; } f=p; } return head; } void namesort(struct book *head) /*按教材名称排序*/ { struct book *p,*t,*f,*h; char ch[20]; int i; h=t=f=p=head; if(head==NULL) {printf("未打开任何文件");getchar();return; }; f=p->next; for(p=head;p->next!=NULL;p=p->next) { for(t=head,f=t->next;t->next!=NULL;f=f->next,t=t->next) { if(strcmp(t->shuming,f->shuming)>0) { strcpy(ch,t->number ); strcpy(t->number,f->number); strcpy(f->number,ch); strcpy(ch,t->shuming ); strcpy(t->shuming,f->shuming); strcpy(f->shuming,ch); i=t->shuliang ; t->shuliang=f->shuliang; f->shuliang=i; i=t->jiage ; t->jiage=f->jiage; f->jiage=i; strcpy(ch,t->zhuanye); strcpy(t->zhuanye,f->zhuanye); strcpy(f->zhuanye,ch); strcpy(ch,t->zuozhe); strcpy(t->zuozhe,f->zuozhe); strcpy(f->zuozhe,ch); strcpy(ch,t->chubanshe); strcpy(t->chubanshe,f->chubanshe); strcpy(f->chubanshe,ch); strcpy(ch,t->beizhu); strcpy(t->beizhu,f->beizhu); strcpy(f->beizhu,ch); } } } print(h); } void chubanshesort(struct book *head) /*按出版社排序*/ { struct book *p,*t,*f,*h; char ch[20]; int i; h=t=f=p=head; if(head==NULL) {printf("未打开任何文件");getchar();return; } f=p->next; for(p=head;p->next!=NULL;p=p->next) { for(t=head,f=t->next;t->next!=NULL;f=f->next,t=t->next) { if(strcmp(t->chubanshe,f->chubanshe)>0) { strcpy(ch,t->number ); strcpy(t->number,f->number); strcpy(f->number,ch); strcpy(ch,t->shuming ); strcpy(t->shuming,f->shuming); strcpy(f->shuming,ch); i=t->shuliang ; t->shuliang=f->shuliang; f->shuliang=i; i=t->jiage ; t->jiage=f->jiage; f->jiage=i; strcpy(ch,t->zhuanye); strcpy(t->zhuanye,f->zhuanye); strcpy(f->zhuanye,ch); strcpy(ch,t->zuozhe); strcpy(t->zuozhe,f->zuozhe); strcpy(f->zuozhe,ch); strcpy(ch,t->chubanshe); ...
延伸阅读:
c程序设计设计题目:计目的:实现简单的学生成绩管理系统在#includeusing namespace std; typedef struct record { char name[20]; /* 姓名 */ char code[20]; /* 学号 */ int mathmark; /* 数学课程成绩 */ int englishmark; /* 英语课...
学生宿舍管理系统 C源码#include#include#include#includeusing namespace std; class student { private: long int stu_num; //学号,宿舍号 char stu_name[40]; //姓名 char class_name[40]; //班别...
用C语言编写一个学生信息管理系统#include "stdio.h" #include "stdlib.h" #include "string.h" #include "conio.h" jiemian(); struct student { char name[50]; char sex[5]; int age; char num[50]; float score...
用C编写一个程序学生信息管理系统#include#include#include#include#defineMax 1000usingnamespacestd;classstudent{private: char name[20]; int number; int grade;public: student(char*,int,int); char...
如何用C语言编写学生信息管理系统参考如下学生信息管理系统的C源代码吧。#include#include/*定义学生结构体*/ struct Student { char ID[20]; char Name[20]; float Mark1; float Mark2; float Mark3; floa...
学生信息管理系统C语言编程展开全部/*用指针变量完成*//*预编译命令*/#include #include #include #include /*自定义数据类型*/ typedef struct student{ char xh[10];//学号 char xm[15];//姓名 int c...
用c语言设计这样的学生成绩统计系统!急#include#include#include#define MAX 1000/*定义学生成绩信息结构*/struct stu{ char id[8]; char name[8]; double Chinese; double Math; double English; double averag...
用C语言做一个学生成绩统计系统求帮忙源代码。可以给你。需要点时间。现在在上课。#includevoid main() { int Password =0,i=0,sum=0; clrscr(); printf("\n===请输入密码!====\n"); while(Password != 1234) { if(i>3) {...
c语言学生期末成绩统计#includeintmain(){ints[20];intsum,max,min,excellent,good,pass,fail;inti;sum=0;max=0;min=100;excellent=good=pass=fail=0;for(i=0;imax)max=s[i];if(s[i]=90)excellen...