好文档 - 专业文书写作范文服务资料分享网站

C语言数据库-学生成绩统计管理系统

天下 分享 时间: 加入收藏 我要投稿 点赞

C语言数据库-学生成绩统计管理系统

学生成绩统计管理系统

C语言数据结构课程作品

指导老师: 学生: 学号: 班级:

C语言数据库-学生成绩统计管理系统

一、代码

#include \、h\#include #include #include #include #include #include #include struct grade {

int score;

struct grade *next;

}; /*定义成绩的结构*/ struct address{ char stu_num[4]; /*学号*/ char hname[10]; /*性别*/ char ename[20]; /*姓名*/ char depart[30]; /*系别*/ char paddress[30]; /*地址*/ char phone[13] /*联系电话*/; struct grade *head; struct address *next; } ;

void loaddata (struct address **had); void printm (struct address *head);

struct address * seek (struct address *head); void revise (struct address *hp); void delate (struct address **head); void saveda (struct address *tou ); void addnew (struct address **had ); void moveg (int i,struct grade **move); void gotoxy(int x,int y);

void sortp(struct address **head); int main ( void ) {

char ch; int c;

struct address *head=NULL; loaddata(&head); do {

system(\);

C语言数据库-学生成绩统计管理系统

printf(\);

printf(\学生信息与成绩统计:\\n\);

printf(\岳鹏程制作\\n\); printf(\); printf(\‖ Menu: ‖\\n\); printf(\‖ 1:print all the personal information、 ‖\\n\); printf(\‖ 2:insert some or one person、 ‖\\n\); printf(\‖ 3:revire some information、 ‖\\n\); printf(\‖ 4:delate some information or a person、 ‖\\n\); printf(\‖ 5:exit、 ‖\\n\); printf(\); printf(\); do

{

scanf(\,&c); getchar( ); }while(c<0||c>6); switch ( c ) {

case 1:

printm(head); break; case 2:

addnew(&head); break; case 3:

revise(head); break; case 4:

delate(&head); break; break; case 5: return 0;

default:

break; }

fflush(stdin);

printf(\); ch=getchar( ); saveda(head);

}while(ch=='y'||ch=='Y'); return 0; }

C语言数据库-学生成绩统计管理系统

void loaddata (struct address **had ) {

FILE *afhead; FILE *gfhead;

struct address *p1,*hp1=NULL,*head=NULL; struct grade *p2 , *hp2 = NULL; int i=0; int j=6;

if( !(afhead = fopen(\、dat\,\))) {

return; }

if( !(gfhead = fopen(\、dat\ , \)) ) {

return; }

while (!feof(afhead)) {

p1 = (struct address *)malloc(sizeof(struct address)); fread(p1,sizeof(struct address),1,afhead); if(feof(afhead)) {

if(!p1) free(p1); break; }

if(i==0) {

p1->next = NULL; p1->head = NULL; head = p1; hp1 = p1; i++;

} /*使头指针指向第一个创建的节点*/ else {

p1->next = NULL; p1->head = NULL; hp1->next = p1; hp1 = hp1->next; } }

*had = head; p1 = *had;

C语言数据库-学生成绩统计管理系统

/*成绩就是后进先出*/ while (!feof(gfhead)) {

do {

p2=(struct grade *)malloc(sizeof(struct grade)); fread(p2,sizeof(struct grade),1,gfhead); p2->next = hp2; hp2 = p2; j --;

}while( j > 0 );

if( !feof(gfhead) && p1 != NULL) {

p1 -> head = hp2; p1 = p1 -> next; } }

fclose(afhead); fclose(gfhead); }

void printm (struct address *head) {

int i=0 , j; float iscore;

struct grade *ghd=NULL; struct address *hd=NULL; hd = head;

system(\); if (hd==NULL) {

printf(\); return ; }

while (hd != NULL) {

gotoxy(1,i+1);

printf(\);

for(j=0;j<6;j++) {

gotoxy(1,i+1+j); printf(\‖\); gotoxy(58,i+1+j);

C语言数据库-学生成绩统计管理系统

C语言数据库-学生成绩统计管理系统学生成绩统计管理系统C语言数据结构课程作品指导老师:学生:学号:班级:C语言数据库-学生成绩统计管理系统一、代码#include\、h\#include#include
推荐度:
点击下载文档文档为doc格式
2mn3q2vqwf3pebe0io3703gjy5zcvb00lrw
领取福利

微信扫码领取福利

微信扫码分享