c语言编程学生管理系统的代码,C语言学生管理系统源代码.doc
C語言學生成績管理系統源代碼,保證能用……
#include "malloc.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
char filename[30];
int n=0,d;
FILE *fp;
typedef struct student
{
int num;
char name[10];
int yuwen;
int shuxue;
int yingyu;
int count;
float aver;
struct student *next;
} aaa;
typedef struct stu
{
int num;
char name[10];
int yuwen,shuxue,yingyu;
int count;
float aver;
} aaaa;
aaa *head;
/*瀏覽*/
void liulan(aaa *head)
{
aaa *p;
if(head==NULL)
printf("\n沒有任何學生資料!\n");
else
{
printf("\t\t\t考試成績管理系統\n");
printf("----------------------------------------------------\n");
printf("|學號\t|姓名\t|語文\t|數學\t|英語\t|總分\t|平均分|\n");
printf("----------------------------------------------------\n");
p=head->next;
do{
printf("|%d\t|%s\t|%d\t|%d\t|%d\t|%d\t|%.1f\t|\n",p->num,p->name,p->yuwen,p->shuxue,p->yingyu,p->yuwen+p->shuxue+p->yingyu,p->count/3.0);
printf("----------------------------------------------------\n");
p=p->next;
}while(p!=NULL);
}
}
/*讀取*/
aaa *duqu ()
{
aaa *s,*head,*p,*q;
n=0;
if((fp=fopen(filename,"rb"))==NULL)
{
printf("不能讀取文件!\n");
return NULL;
}
head=malloc(sizeof(aaa));
if(head==NULL)
{
printf("內存空間不足,文件讀取失敗!\n");
return NULL;
}
head->next=NULL;
p=head;
q=malloc(sizeof(aaa));
if(!feof(fp))
{
fread(q,sizeof(aaaa),1,fp);
q->next=NULL;
}
while(!feof(fp))
{
s=malloc(sizeof(aaa));
fread(s,sizeof(aaaa),1,fp);
s->next=NULL;
p->next=q;
p=q;
q=s;
n++;
}
return head;
}
/*輸入函數*/
aaa *shuru (aaa *head)
{
aaa *q,*p,*s;
aaa newstd;
n=0;
q=head;
do{
q=head;
s=malloc(sizeof(aaa));
if(s==NULL)
{
printf("內存不足,添加學生成績失敗!\07\n");
break;
}
printf("請輸入學號(輸入0退出):");
scanf("%d",&newstd.num);
if(newstd.num==0)
break;
if(newstd.num<0)
{
printf("輸入學號有誤,請重新輸入\n");
break;
}
p=head->next;
while(p!=NULL)
{
if(p->num==newstd.num)
{
printf("輸入學號重復,請重新輸入!\n");
break;
}
p=p->next;
q=q->next;
}
if(p==NULL)
{
總結
以上是生活随笔為你收集整理的c语言编程学生管理系统的代码,C语言学生管理系统源代码.doc的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 白杨树的作者是谁啊?
- 下一篇: w ndows连接USB不正常,Rasp