亚洲一区爱区精品无码_无码熟妇人妻AV_日本免费一区二区三区最新_国产AV寂寞骚妇

圖書管理系統(tǒng)含源代碼c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)報(bào)告3篇 c語言程序設(shè)計(jì)圖書管理系統(tǒng)報(bào)告

時(shí)間:2022-12-21 23:18:12 綜合范文

  下面是范文網(wǎng)小編收集的圖書管理系統(tǒng)含源代碼c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)報(bào)告3篇 c語言程序設(shè)計(jì)圖書管理系統(tǒng)報(bào)告,供大家閱讀。

圖書管理系統(tǒng)含源代碼c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)報(bào)告3篇 c語言程序設(shè)計(jì)圖書管理系統(tǒng)報(bào)告

圖書管理系統(tǒng)含源代碼c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)報(bào)告1

#include<> #include<> #include<> //火車票結(jié)構(gòu)體類型// typedef struct Node {int num;

//編號(hào)// char name[20];

//起點(diǎn)和終點(diǎn)// char time[5];

//出發(fā)時(shí)間// int price;

//車票價(jià)格// int amount;

//剩余數(shù)量// struct Node *next;}Node;//創(chuàng)建鏈表并輸入數(shù)據(jù)// struct Node *creat(){ struct Node *head,*r,*s;

  int i=0;

  char choice;

  head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;r=head;do {

  s=(struct Node *)malloc(sizeof(struct Node));s->next=NULL;printf(“請輸入第%d種火車票的信息:n”,++i);printf(“請輸入火車的編號(hào):”);

  scanf(“%d”,&s->num);

  printf(“起點(diǎn)和終點(diǎn):”);scanf(“%s”,s->name);printf(“出發(fā)時(shí)間:”);scanf(“%s”,s->time);printf(“車票價(jià)格:”);scanf(“%d”,&s->price);printf(“剩余數(shù)量:”);scanf(“%d”,&s->amount);

  r->next=s;

  r=s;

  printf(“Continue?(Y/N)”);scanf(“%s”,&choice);}while(choice=='Y'||choice=='y');

  r->next=NULL;return(head);} //將單鏈表中的信息保存到文件中// void save(struct Node *h){

  struct Node *s;FILE *fp;

  char filename[10]=“”;

  fp=fopen(“”,“wt”);if(fp==NULL){

  printf(“n寫文件出錯(cuò),按任意鍵退出!”);getchar();exit(1);}

  for(s=h->next;s!=NULL;s=s->next)

  fprintf(fp,“%d %s %s %d %d n”,s->num,s->name,s->time,s->price,s->amount);

  getchar();fclose(fp);} // 從文件中讀取信息并存入單鏈表中// struct Node *read(){ struct Node *head,*r,*s;FILE *fp;char filename[10]=“”;fp=fopen(“”,“rt”);if(fp==NULL){

  printf(“讀文件錯(cuò)誤,按任意鍵退出!”);getchar();exit(1);} head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;r=head;while(!feof(fp)){

  s=(struct Node *)malloc(sizeof(struct Node));fscanf(fp,“%d %s %s %d %d”,&s->num,s->name,s->time,&s->price,&s->amount);

  r->next=s;r=s;

} r->next=NULL;fclose(fp);

  return head;} //將鏈表中的數(shù)據(jù)輸出// void print(struct Node *h){

  struct Node *s;

  printf(“n火車票信息如下:n”);

  printf(“~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n”);printf(“編號(hào)

  起點(diǎn)和終點(diǎn)

  出發(fā)時(shí)間

  車票價(jià)格

  剩余票數(shù):n”);

  for(s=h->next;s->next!=NULL;s=s->next){ printf(“ %d

%10s

%5s %10d %6dn”,s->num,s->name,s->time,s->price,s->amount);} } //鏈表查詢// struct Node * find(struct Node *h){ int i,j;char s[20];printf(“tt

  查詢方法有以下幾種:n”);printf(“tt

  1.火車票編號(hào)n”);printf(“tt

  2.起點(diǎn)和終點(diǎn)n”);printf(“tt

  3.出發(fā)時(shí)間n”);printf(“tt

  4.車票價(jià)格n”);printf(“tt

  5.剩余票數(shù)n”);printf(“請輸入您要查詢的方法的序號(hào):”);scanf(“%d”,&i);switch(i){ case 1:printf(“請輸入你要查詢火車票的編號(hào):”);scanf(“%d”,&j);

  while(h->next!=NULL)

{

  h=h->next;

  if(h->num==j)return h;

}

  return NULL;break;case 2:printf(“請輸入您要查詢火車票的起點(diǎn)和終點(diǎn):”);scanf(“%s”,s);while(h->next!=NULL){

  h=h->next;if(strcmp(h->name,s)==0)

  return h;

} return NULL;break;case 3:printf(“請輸入您要查詢火車票的時(shí)間:”);

  scanf(“%s”,s);

  while(h->next!=NULL)

{

  h=h->next;

  if(strcmp(h->time,s)==0)

  return h;

}

  return NULL;

  break;case 4:printf(“請輸入你要查詢火車票的價(jià)格 :”);scanf(“%d”,&j);

  while(h->next!=NULL)

{

  h=h->next;

  if(h->price==j)

  return h;

}

  return NULL;

  break;case 5:printf(“請輸入你要查詢火車票的剩余票數(shù):”);scanf(“%d”,&j);

  while(h->next!=NULL)

{

  h=h->next;

  if(h->amount==j)

  return h;

} return NULL;

  break;} } //修改信息// change(struct Node *h,int k){ int j;struct Node *p;p=find(h);printf(“------------n”);printf(“t

  您要修改哪一項(xiàng)?n”);printf(“t

  1.火車編號(hào)n”);printf(“t

  2.起點(diǎn)和終點(diǎn)n”);printf(“t

  3.出發(fā)時(shí)間n”);printf(“t

  4.車票價(jià)格n”);

  printf(“t

  5.剩余票數(shù)n”);printf(“t

  0.退出系統(tǒng)n”);

  printf(“------------n”);printf(“請輸入您要修改項(xiàng)的編號(hào):”);scanf(“%d”,&j);switch(j)

{ case 1:

  printf(“修改后的火車編號(hào):”);

  scanf(“%d”,&p->num);

  break;

  case 2:

  printf(“修改后的起點(diǎn)和終點(diǎn):”);

  scanf(“%s”,p->name);

  break;

  case 3:

  printf(“修改后的出發(fā)時(shí)間:”);

  scanf(“%s”,p->time);

  break;

  case 4:

  printf(“修改后的車票價(jià)格:”);

  scanf(“%d”,&p->price);

  break;

  case 5:

  printf(“修改后的剩余票數(shù):”);

  scanf(“%d”,&p->amount);

  break;

  case 0:break;} } //刪除信息// delete(struct Node *h){ struct Node *p;

  int j;

  printf(“請輸入您要?jiǎng)h除的火車票的編號(hào):”);scanf(“%d”,&j);p=h->next;

  if(p==NULL)

  return 0;while(p!=NULL){ if(p->num==j){

  h->next=p->next;

  free(p);

  return 1;} h=p;p=p->next;

} return 0;} //添加信息// void append(){

  struct Node *p;

  fILE *fp;

  fp=fopen(“”,“at+”);

  if(fp==NULL)

{

  printf(“寫文件出錯(cuò),按任意鍵返回.n”);getchar();exit(1);

}

  printf(“請輸入要添加的火車票的信息:火車編號(hào),起點(diǎn)和終點(diǎn),出發(fā)時(shí)間,車票價(jià)格,剩余票數(shù):n”);scanf(“%d%s%s%d%d”,&p->num,p->name,p->time,&p->price,&p->amount);fprintf(fp,“%d %s %s %d %dn”,p->num,p->name,p->time,p->price,p->amount);getchar();fclose(fp);} //數(shù)據(jù)的統(tǒng)計(jì)// void count(struct Node *h){ struct Node *s;s=h;int i,j,k,n=0;printf(“*****************************************************************************n”);

  printf(“tt

  請選擇您要統(tǒng)計(jì)項(xiàng)目的序號(hào):n”);

  printf(“tt

  1.車票價(jià)格n”);

  printf(“tt

  2.剩余票數(shù)n”);printf(“tt

  0.退出界面n”);

  scanf(“%d”,&i);switch(i)

{

  case 1:

  printf(“請輸入您要統(tǒng)計(jì)車票的價(jià)格的標(biāo)準(zhǔn):”);

  scanf(“%d”,&j);

  printf(“tt

  請選擇低于或高于標(biāo)準(zhǔn):n”);

  printf(“tt

  1.價(jià)格低于%d的個(gè)數(shù)n”,j);

  printf(“tt

  2.價(jià)格高于%d的個(gè)數(shù)n”,j);

  scanf(“%d”,&k);

  if(k==1)

{

  for(s=h->next;s->next!=NULL;s=s->next)

  if(s->price

  n++;

  printf(“車票價(jià)格低于%d的個(gè)數(shù)有%d個(gè).n”,j,n);

}

  else

{

  for(s=h->next;s->next!=NULL;s=s->next)

  if(s->price>j)

  n++;

  printf(“車票價(jià)格低于%d的個(gè)數(shù)有%d個(gè).n”,j,n);

}

  break;

  case 2:

  printf(“請輸入您要統(tǒng)計(jì)剩余票數(shù)的數(shù)量:”);

  scanf(“%d”,&j);

  printf(“tt

  請選擇低于或高于所輸票數(shù):n”);

  printf(“tt

  1.票數(shù)低于%d的個(gè)數(shù)n”,j);

  printf(“tt

  2.票數(shù)高于%d的個(gè)數(shù)n”,j);

  scanf(“%d”,&k);

  if(k==1)

{

  for(s=h->next;s->next!=NULL;s=s->next)

  if(s->amount

  n++;

  printf(“剩余票數(shù)低于%d的個(gè)數(shù)有%d個(gè).n”,j,n);

}

  else

{

  for(s=h->next;s->next!=NULL;s=s->next)

  if(s->amount>j)

  n++;

  printf(“剩余票數(shù)高于%d的個(gè)數(shù)有%d個(gè).n”,j,n);

}

  break;

  case 0:break;

} } //保存用戶和密碼到文件中// void save_user(){

  char file[10]=“”;FILE *fp;char name[20];char pwd[10];fp=fopen(“”,“at+”);if(fp==NULL){ printf(“n寫文件出錯(cuò),按任意鍵退出.n”);

  getchar();exit(1);} printf(“請輸入用戶名:”);

  scanf(“%s”,name);printf(“請輸入密碼:”);

  scanf(“%s”,pwd);

  fprintf(fp,“%s %sn”,name,pwd);

  getchar();

  fclose(fp);

  printf(“用戶注冊成功!n”);} //檢驗(yàn)用戶和密碼是否匹配// int check(char *name,char *pwd){ char name1[20];char pwd1[10];FILE *fp;char file[10]=“”;if((fp=fopen(“”,“rt”))==NULL){

  printf(“讀文件出錯(cuò),按任意鍵退出!n”);

  getchar();

  exit(1);}

  while(!feof(fp)){

  fscanf(fp,“%s %s”,name1,pwd1);

  if(strcmp(name1,name)==0&&strcmp(pwd1,pwd)==0)

  return 1;} return 0;} //數(shù)據(jù)排序// void sort(struct Node *h){ struct Node *s,*p,*m,*n;int t,t1,t2,t3;char s1[20];char s2[10];

  printf(“車票價(jià)格由小到大排序如下:n”);for(s=h->next;s->next!=NULL;s=s->next)for(p=s->next;p->next!=NULL;p=p->next)

  if(s->price>p->price)

{

  t1=s->num;s->num=p->num;p->num=t1;

  t2=s->price;s->price=p->price;p->price=t2;

  t3=s->amount;s->amount=p->amount;p->amount=t3;

  strcpy(s1,s->name);strcpy(s->name,p->name);strcpy(p->name,s1);

  strcpy(s2,s->time);strcpy(s->time,p->time);strcpy(p->time,s2);

}

  print(h);printf(“nn剩余車票數(shù)量由多到少排序如下:n”);for(s=h->next;s->next!=NULL;s=s->next)

  for(p=s->next;p->next!=NULL;p=p->next)

  if(s->amount

  amount)

{

  t1=s->num;s->num=p->num;p->num=t1;

  t2=s->price;s->price=p->price;p->price=t2;

  t3=s->amount;s->amount=p->amount;p->amount=t3;

  strcpy(s1,s->name);strcpy(s->name,p->name);strcpy(p->name,s1);

  strcpy(s2,s->time);strcpy(s->time,p->time);strcpy(p->time,s2);

} print(h);} void main(){ struct Node *head,*p;int i,j,k;head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;char name[20];char pwd[10];printf(“n***************歡迎進(jìn)入火車票管理系統(tǒng)******************n”);printf(“tt 1.用戶登錄n”);printf(“tt 2.用戶注冊n”);printf(“tt 0.退出系統(tǒng) n”);printf(“請輸入所選序號(hào):”);scanf(“%d”,&k);

  switch(k){ case 1: printf(“請輸入用戶名:”);

  scanf(“%s”,name);

  printf(“請輸入密碼:”);

  scanf(“%s”,pwd);

  if(check(name,pwd))

{

  printf(“密碼正確.n”);

  do

{

  printf(“nntt*********************歡迎進(jìn)入火車票管理系統(tǒng)***********************n”);

  printf(“tt

  1.錄入火車票信息tt

  2.添加火車票信息n”);

  printf(“tt

  3.修改火車票信息tt

  4.刪除火車票信息n”);

  printf(“tt

  5.打印火車票信息tt

  6.查詢火車票信息n”);

  printf(“tt

  7.統(tǒng)計(jì)火車票信息tt

  8.火車票銷售排行n”);

  printf(“tt

  0.退出系統(tǒng)n”);

  printf(“請輸入您要進(jìn)入菜單的序號(hào)(0-8):”);

  scanf(“%d”,&i);

  switch(i)

{

  case 1:

  printf(“請錄入火車票信息nn”);

  head=creat();

  save(head);

  head=read();

  break;

  case 2:

  append();

  break;

  case 3:

  printf(“請輸入您要修改的火車票的編號(hào):”);

  scanf(“%d”,&j);

  change(head,j);

  save(head);

  break;

  case 4:

  head=read();

  if(delete(head))

{

  printf(“已正確刪除!n”);

  save(head);

}

  else

  printf(“要?jiǎng)h除的結(jié)點(diǎn)不存在!n”);

  break;

  case 5:

  head=read();

  print(head);

  break;

  case 6:

  printf(“請輸入您要查詢火車票的編號(hào)(以0結(jié)束):”);

  scanf(“%d”,&j);

{

  p=find(head);

  printf(“編號(hào)

  起點(diǎn)和終點(diǎn)

  出發(fā)時(shí)間

  車票價(jià)格

  剩余票數(shù):n”);

  printf(“%d

%10s

%5s %10d %6dn”,p->num,p->name,p->time,p->price,p->amount);

  printf(“請繼續(xù)輸入序號(hào)(以0結(jié)束):”);

  scanf(“%d”,&j);

}

  break;

  case 7: head=read();count(head);break;

  case 8: sort(head);break;

  case 0: printf(“************************用!*****************************n”);break;

}

}while(i!=0);

}

  else

  printf(“密碼錯(cuò)誤或用戶名不存在.n”);

  break;case 2:save_user();break;case 0:break;}

  謝

  謝

  使

圖書管理系統(tǒng)含源代碼c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)報(bào)告2

  課 程 設(shè) 計(jì) 課程設(shè)計(jì)名稱: C語言程序設(shè)計(jì) 題 目:學(xué)籍管理系統(tǒng) 學(xué) 生 姓 名: 學(xué)生學(xué)號(hào) : 學(xué) 院(系): 軟件學(xué)院 專 業(yè) 班 級(jí): 指 導(dǎo) 教 師:

  設(shè)計(jì)時(shí)間: 2012 年 9 月 日 ? 2012 年 9月_ 14 日

  實(shí)驗(yàn)題目:學(xué)籍管理系統(tǒng)一、實(shí)驗(yàn)?zāi)康?/p>

  綜合應(yīng)用所學(xué)的C語言程序設(shè)計(jì)知識(shí),自行設(shè)計(jì)并實(shí)現(xiàn)一個(gè)較為完整的小型管理信息系統(tǒng)。通過系統(tǒng)分析、系統(tǒng)設(shè)計(jì)、編程實(shí)現(xiàn),寫實(shí)驗(yàn)報(bào)告等環(huán)節(jié),初步掌握軟件系統(tǒng)的設(shè)計(jì)方法和步驟,提高靈活運(yùn)用程序語言進(jìn)行軟件開發(fā)的技能,提高程序設(shè)計(jì)水平和分析問題、解決問題的能力。

  二、實(shí)驗(yàn)內(nèi)容

  1):熟悉C語言的開發(fā)環(huán)境,按照給定的上機(jī)步驟練習(xí)完成;

  2):熟悉C程序的編輯,編譯,鏈接和運(yùn)行的過程。3):編譯一個(gè)應(yīng)用系統(tǒng)程序,形成一個(gè)軟件系統(tǒng)。

  三.實(shí)驗(yàn)要求

、分析系統(tǒng)功能

(1)用戶進(jìn)入主菜單后,就會(huì)在看到,菜單選項(xiàng)中添加有系統(tǒng)的各項(xiàng)功能,進(jìn)入的

  應(yīng)的選項(xiàng)就可進(jìn)行相應(yīng)的操作.其主要功能有:

  1、錄入學(xué)生信息

  2、刪除學(xué)生信息

  3、查詢學(xué)生信息

  4、學(xué)生信息排序

  5、改學(xué)生信息

  6、保存退出系統(tǒng)

(2)用戶選擇所需操作的選項(xiàng),進(jìn)入相應(yīng)的操作界面,在這里用戶就可開始進(jìn)行操作。

  四、使用說明

  學(xué)生學(xué)籍管理系統(tǒng)是針對學(xué)生信息的管理,主要功能是添加學(xué)生信息、刪除學(xué)生信息、查詢學(xué)生信息、學(xué)生信息排序、修改學(xué)生信息、保存信息。

  1,用戶打開程序,進(jìn)入主界面,輸入學(xué)生信息如圖

  2,按回車進(jìn)入主菜單,列出各項(xiàng)功能如圖

  輸入1,是查詢整個(gè)班級(jí)的學(xué)生的信息,如圖

  輸入2,是查詢個(gè)別學(xué)生的信息,如查詢第一學(xué)生的信息,如圖

  輸入3,是刪除個(gè)別學(xué)生的信息,如刪除第一個(gè)學(xué)生,如圖

  輸入4,是插入某些學(xué)生的信息,如插入第三個(gè),如圖

  輸入5,是修改某個(gè)同學(xué)的信息,如刪除第一個(gè),如圖

  三、心得體會(huì)

  兩周的課程過起來其實(shí)也是很快的。這是我第一次做課程設(shè)計(jì),起初還沒做的時(shí)候覺得很快自己就將得編一個(gè)較大的程序,將會(huì)很有意思。帶著最初的好奇心,新鮮感就這樣開始了第一天的編程,結(jié)果是大失所望。做課程設(shè)計(jì)并不是自己想象中的那樣有意思,而是很枯燥,很乏味的。也沒想象中的那樣簡單,并不是像我們平時(shí)上C語言課時(shí),每次編的那些小程序,沒那么簡單。我們現(xiàn)在要做的就是將我們平時(shí)學(xué)的,做的那些小程序都合理的湊到一塊兒來。而把這些小程序都加到一塊兒來,并不是隨意的將它們放到一個(gè)程序中就完事的,而是必須得合理,且得顧及到各個(gè)方面。

  正是由于編程的紛繁復(fù)雜,且結(jié)構(gòu)的嚴(yán)謹(jǐn),因此編程的過程中到處是困難和問題。它考驗(yàn)的不僅是我們的平時(shí)用功程度,以及我們對所學(xué)知識(shí)的熟練掌握程度、應(yīng)用的靈活程度,它還考驗(yàn)我們的毅力。在剛開始的幾天時(shí),由于前一陣忙于各科的考試,C語言已經(jīng)好久沒碰了,所學(xué)的知識(shí)都有點(diǎn)遺忘了,在編寫時(shí)處處碰壁,一直會(huì)停頓翻書,編得自己都開始心煩意亂了,實(shí)在是編不下去了,于是索性就停了三天去看書,先把書給吃透。并在后期的程序調(diào)試中也碰到不少的問題,好多問題自己反復(fù)檢查了幾遍都沒查出,但在老師的幫助下還是一下就查出了。并不是這些問題多難,而是不夠心細(xì)。因此做課程設(shè)計(jì)、編程時(shí),它還考驗(yàn)并鍛煉我們的心細(xì)程度。

  經(jīng)過這次的課程設(shè)計(jì)的實(shí)踐,我受益頗多,不僅是對我掌握知識(shí)、靈活運(yùn)用知識(shí)的一次考驗(yàn)和鍛煉,也是對我生活態(tài)度的一次鍛煉,讓我學(xué)會(huì)心細(xì)和擁有毅力,更具信心和恒心,碰到困難不再退縮,而是堅(jiān)強(qiáng)面對。

  四,程序編碼

/*做一個(gè)學(xué)生的學(xué)籍管理系統(tǒng),有輸入,查詢,刪除,增加,修改等功能*/ #include <>/*程序需要的頭文件*/ #include<>

#include<> #include <> #include <> #define SIZE 4

/*聲明數(shù)組的大小,可以任意改動(dòng)*/ int board[50][50];/*聲明一個(gè)表格的數(shù)組*/ int cur_x, cur_y;/*定義坐標(biāo)*/

  void init();/*聲明一個(gè)初始化界面的函數(shù)*/ void clear();/*清除界面的函數(shù)*/

  void draw_board();/*聲明一個(gè)函數(shù)畫表格*/ struct student{/*創(chuàng)建一個(gè)學(xué)生的結(jié)構(gòu)體*/

  char stuNo[8];

/*學(xué)生的學(xué)號(hào)*/

  char name[10];/*學(xué)生的姓名*/

  char sex[2];/*學(xué)生的性別*/

  char score[4];

/*學(xué)生的分?jǐn)?shù)*/

  char address[10];/*學(xué)生的地址*/ };void init()/*初始化函數(shù)*/ {

  int gdriver, gmode, i, j;

  gdriver = DETECT;/*圖形界面的驅(qū)動(dòng)聲明*/

  registerbgidriver(EGAVGA_driver);

  initgraph(&gdriver, &gmode, “");

  for(i = 0;i < 10;i ++)

  for(j = 0;j < 10;j++)/*聲明坐標(biāo)的間距*/

  board[i][j] = 0;

  cur_x = 1;

  cur_y = 1;}

  void destroy()/*關(guān)閉圖形驅(qū)動(dòng)器*/ {

  closegraph();}

  void draw_board(int n)/*畫表格的函數(shù)*/ {

  int i, j;

  for(i = 20;i <=5*160+80;i += 90)/*劃橫線的循環(huán)*/

{

  line(i, 20, i,(n+1)*60+20);

}

  for(i = 20;i <=(n+1)*60+30;i += 60)/*劃縱線的循環(huán)*/

{

  line(20, i, 5*110+10, i);

} }

  void main(){

  struct student stu[SIZE],stu_temp;/*聲明結(jié)構(gòu)體變量*/

  fILE *fp;

/*聲明文件型的指針*/

  int i,j,n,m,h;

  int c=1;/*c為循環(huán)次數(shù)*/

  h=0;

  fp=fopen(”c:“,”wb+“);/*打開寫入文件*/

  init();/*調(diào)用函數(shù)*/

  draw_board(SIZE);

  if(fp==NULL)/*驗(yàn)證文件是否為空*/

{

  printf(”cannot open this filen“);

  exit(0);

}

  printf(”input all %d students's “,SIZE);/*畫輸入學(xué)生信息的表*/

  gotoxy(17,4);

  printf(”stuNo“);

  gotoxy(29,4);

  printf(”name“);

  gotoxy(41,4);

  printf(”sex“);

  gotoxy(52,4);

  printf(”score“);

  gotoxy(63,4);

  printf(”address“);

  for(i=0;i

{

  gotoxy(7,4*(i+2));

  printf(”%d“,i);

  gotoxy(17,4*(i+2));

  scanf(”%s“,&stu[i].stuNo);

  gotoxy(29,4*(i+2));

  scanf(”%s“,&stu[i].name);

  gotoxy(41,4*(i+2));

  scanf(”%s“,&stu[i].sex);

  gotoxy(52,4*(i+2));

  scanf(”%s“,&stu[i].score);

  gotoxy(63,4*(i+2));

  scanf(”%s“,&stu[i].address);

}

  for(i=0;i

  if(fwrite(&stu[i],sizeof(struct student),1,fp)!=1)

{

  printf(”file write error!“);

  exit(0);

}

  rewind(fp);

  clrscr();

  for(c=1;c<100;c++)/*創(chuàng)建一個(gè)圖形界面*/

{

  textbackground(0);

  textcolor(1);

  gotoxy(29,7);

  printf(”read->1“);

  gotoxy(29,9);

  printf(”find->2“);

  gotoxy(29,11);

  printf(”delete->3“);

  gotoxy(29,13);

  printf(”insert->4“);

  gotoxy(29,15);

  printf(”modify->5“);

  gotoxy(29,17);

  printf(”plese enter j= “);

  scanf(”%d“,&j);

  clrscr();

  if(j==1)/*當(dāng)輸入為1時(shí),顯示整個(gè)班級(jí)

{的學(xué)生信息*/

  draw_board(SIZE);

  gotoxy(17,4);

  printf(”stuNo“);

  gotoxy(29,4);

  printf(”name“);

  gotoxy(41,4);

  printf(”sex“);

  gotoxy(52,4);

  printf(”score“);

  gotoxy(63,4);

  printf(”address“);

  for(i=0;i

{

  fread(&stu_temp,sizeof(struct student),1,fp);出每個(gè)學(xué)生的信息*/

  gotoxy(7,4*(i+2));

  printf(”%d“,i);

  gotoxy(17,4*(i+2));

  printf(”%s“,stu[i].stuNo);

  gotoxy(29,4*(i+2));

  printf(”%s“,stu[i].name);

  gotoxy(41,4*(i+2));

  printf(”%s“,stu[i].sex);

  gotoxy(52,4*(i+2));

  printf(”%s“,stu[i].score);

  gotoxy(63,4*(i+2));

  printf(”%s“,stu[i].address);

}

  fclose(fp);

/*關(guān)閉文件*/

  getch();/*留在當(dāng)前界面*/

  clrscr();/*清屏*/

}

  if(j==2)/*當(dāng)輸入為2時(shí),查找某個(gè)學(xué)生的 {信息*/

  rewind(fp);/*移動(dòng)指針到最前*/

  printf(”look up the nth(n<4)student,plese enter n= :n“);/*輸入要查找的學(xué)生

  scanf(”%d“,&i);位置*/

  clrscr();

  draw_board(1);/*畫表格*/

  gotoxy(17,4);

  printf(”stuNo“);

  gotoxy(29,4);

  printf(”name“);

  gotoxy(41,4);

  printf(”sex“);

  gotoxy(52,4);

  printf(”score“);

  gotoxy(63,4);

  printf(”address“);

  fseek(fp,(i-1)*sizeof(struct student),0);/*打開文件查找,讀出信

  fread(&stu_temp,sizeof(struct student),1,fp);息*/

  gotoxy(7,8);

  printf(”%d“,i);

  gotoxy(17,8);

  printf(”%s“,stu[i].stuNo);

  gotoxy(29,8);

  printf(”%s“,stu[i].name);

  gotoxy(41,8);

  printf(”%s“,stu[i].sex);

  gotoxy(52,8);

  printf(”%s“,stu[i].score);

  gotoxy(63,8);

  printf(”%s“,stu[i].address);

}

  fclose(fp);

  getch();

  clrscr();

  if(j==3)/*當(dāng)輸入為3,刪除某個(gè)學(xué)生的信息*/

{

  h=h-1;/*表格少畫一格*/

  printf(”you want delete nth student,plese enter n= “);

  scanf(”%d“,&n);

  draw_board(SIZE+h);/*調(diào)用函數(shù)畫表格*/

  gotoxy(17,4);

  printf(”stuNo“);

  gotoxy(29,4);

  printf(”name“);

  gotoxy(41,4);

  printf(”sex“);

  gotoxy(52,4);

  printf(”score“);

  gotoxy(63,4);

  printf(”address“);

  for(m=n;m

{

  strcpy(stu[m].stuNo,stu[m+1].stuNo);

  strcpy(stu[m].name,stu[m+1].name);

  strcpy(stu[m].sex,stu[m+1].sex);

  strcpy(stu[m].score,stu[m+1].score);

  strcpy(stu[m].address,stu[m+1].address);

}

  for(i=0;i

{

  fread(&stu_temp,sizeof(struct student),1,fp);個(gè)表格*/

  gotoxy(7,4*(i+2));

  printf(”%d“,i);

  gotoxy(17,4*(i+2));

  printf(”%s“,stu[i].stuNo);

  gotoxy(29,4*(i+2));

  printf(”%s“,stu[i].name);

  gotoxy(41,4*(i+2));

  printf(”%s“,stu[i].sex);

  gotoxy(52,4*(i+2));

  printf(”%s“,stu[i].score);

  gotoxy(63,4*(i+2));

  printf(”%s“,stu[i].address);

}

  fclose(fp);

  getch();

  clrscr();

} if(j==4)/*當(dāng)輸入為4時(shí),增加一個(gè)學(xué)生

{信息*/

  h=h+1;

  printf(”you want insert nth student,plese enter n= “);

  scanf(”%d“,&n);

  for(m=n;m

{息*/

  strcpy(stu[m+1].stuNo,stu[m].stuNo);

  strcpy(stu[m+1].name,stu[m].name);

  strcpy(stu[m+1].sex,stu[m].sex);

  strcpy(stu[m+1].score,stu[m].score);

  strcpy(stu[m+1].address,stu[m].address);

}

  draw_board(1);/*調(diào)用函數(shù)畫表格*/

  gotoxy(7,4*2);

  printf(”%d“,n);

  gotoxy(17,4);

  printf(”stuNo“);

  gotoxy(29,4);

  printf(”name“);

  gotoxy(41,4);

  printf(”sex“);

  gotoxy(52,4);

  printf(”score“);

  gotoxy(63,4);

  printf(”address“);

  gotoxy(17,8);/*輸入一個(gè)新學(xué)生的 scanf(”%s“,&stu[n].stuNo);信息*/

  gotoxy(29,8);

  scanf(”%s“,&stu[n].name);

  gotoxy(41,8);

  scanf(”%s“,&stu[n].sex);

  gotoxy(52,8);

  scanf(”%s“,&stu[n].score);

  gotoxy(63,8);

  scanf(”%s“,&stu[n].address);

  gotoxy(7,8);

  printf(”%d“,i);

  gotoxy(17,8);

  printf(”%s“,stu[n].stuNo);

  gotoxy(29,8);

  printf(”%s“,stu[n].name);

  gotoxy(41,8);

  printf(”%s“,stu[n].sex);

  gotoxy(52,8);

  printf(”%s“,stu[n].score);

  gotoxy(63,8);

  printf(”%s“,stu[n].address);

  clrscr();

  draw_board(SIZE+h);

  gotoxy(17,4);

  printf(”stuNo“);

  gotoxy(29,4);

  printf(”name“);

  gotoxy(41,4);

  printf(”sex“);

  gotoxy(52,4);

  printf(”score“);

  gotoxy(63,4);

  printf(”address“);

  for(i=0;i

{

  fread(&stu_temp,sizeof(struct student),1,fp);表格*/

  gotoxy(7,4*(i+2));

  printf(”%d“,i);

  gotoxy(17,4*(i+2));

  printf(”%s“,stu[i].stuNo);

  gotoxy(29,4*(i+2));

  printf(”%s“,stu[i].name);

  gotoxy(41,4*(i+2));

  printf(”%s“,stu[i].sex);

  gotoxy(52,4*(i+2));

  printf(”%s“,stu[i].score);

  gotoxy(63,4*(i+2));

  printf(”%s“,stu[i].address);

}

  fclose(fp);

  getch();

  clrscr();

}

  if(j==5)/*當(dāng)輸入為5,修改某個(gè)學(xué)生

{信息*/

  printf(”you want to modify nth student information,plese enter n= “);

  scanf(”%d“,&n);

/*輸入修改的學(xué)生的位置*/

  draw_board(1);

  draw_board(1);

  gotoxy(7,4*2);

  printf(”%d“,n);

  gotoxy(17,4);

  printf(”stuNo“);

  gotoxy(29,4);

  printf(”name“);

  gotoxy(41,4);

  printf(”sex“);

  gotoxy(52,4);

  printf(”score“);

  gotoxy(63,4);

  printf(”address“);

  gotoxy(17,8);

/*輸入新的學(xué)生信息*/

  scanf(”%s“,&stu[n].stuNo);

  gotoxy(29,8);

  scanf(”%s“,&stu[n].name);

  gotoxy(41,8);

  scanf(”%s“,&stu[n].sex);

  gotoxy(52,8);

  scanf(”%s“,&stu[n].score);

  gotoxy(63,8);

  scanf(”%s“,&stu[n].address);

  gotoxy(7,8);

  clrscr();

  draw_board(SIZE);

  gotoxy(17,4);

  printf(”stuNo“);

  gotoxy(29,4);

  printf(”name“);

  gotoxy(41,4);

  printf(”sex“);

  gotoxy(52,4);

  printf(”score“);

  gotoxy(63,4);

  printf(”address“);

  for(i=0;i

{

  fread(&stu_temp,sizeof(struct student),1,fp);

  gotoxy(7,4*(i+2));

  printf(”%d“,i);

  gotoxy(17,4*(i+2));

  printf(”%s“,stu[i].stuNo);

  gotoxy(29,4*(i+2));

  printf(”%s“,stu[i].name);

  gotoxy(41,4*(i+2));

  printf(”%s“,stu[i].sex);

  gotoxy(52,4*(i+2));

  printf(”%s“,stu[i].score);

  gotoxy(63,4*(i+2));

  printf(”%s",stu[i].address);

}

  fclose(fp);/*關(guān)閉文件*/

  getch();/*保留在這個(gè)界面上*/

  clrscr();/*清屏*/

}

}

}

圖書管理系統(tǒng)含源代碼c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)報(bào)告3

  目錄

  前言..................................................................................................................2 概要設(shè)計(jì)..................................................................................................................3 數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)...........................................................................................3 算法設(shè)計(jì)...................................................................................................3 建立鏈表的算法..............................................................................3 鏈表插入一個(gè)元素的算法..............................................................3 鏈表刪除一個(gè)元素的算法..............................................................3 ADT描述..................................................................................................4

  詳細(xì)設(shè)計(jì)…………………………………………… ……………………………… 4

  數(shù)據(jù)存儲(chǔ)結(jié)構(gòu)……………………………… ………………………………

  主要偽代碼…… …………………… ……………………………………… 4 軟件測試..................................................................................................................7 心得體會(huì)................................................................................................................11 源代碼...................................................................................................................12 參考文獻(xiàn)………………………………………………………………………...21

  前言

  數(shù)據(jù)結(jié)構(gòu)是計(jì)算機(jī)程序設(shè)計(jì)的重要理論技術(shù)基礎(chǔ),它不僅是計(jì)算機(jī)學(xué)科的核心課程,而且已經(jīng)成為其他理工專業(yè)的熱門選修課。

  隨著計(jì)算機(jī)科學(xué)的技術(shù)和發(fā)展,計(jì)算機(jī)的功能和運(yùn)算速度不斷地提高,其應(yīng)用于信息處理的范圍日益擴(kuò)大。與之相應(yīng)的,計(jì)算機(jī)的加工處理對象也從簡單的數(shù)據(jù)發(fā)展到一般的符號(hào),進(jìn)而發(fā)展到更復(fù)雜的數(shù)據(jù)結(jié)構(gòu)。數(shù)據(jù)結(jié)構(gòu)是計(jì)算機(jī)程序設(shè)計(jì)的重要理論技術(shù)基礎(chǔ),數(shù)據(jù)結(jié)構(gòu)的表示和操作都涉及到算法,如何描述數(shù)據(jù)的結(jié)構(gòu)和討論有關(guān)的算法,又涉及到程序設(shè)計(jì)語言。因此,它不僅是計(jì)算機(jī)學(xué)科的核心課程,而且已經(jīng)成為其他理工專業(yè)的熱門選修課。我們通過對這門基礎(chǔ)課程的學(xué)習(xí),要學(xué)會(huì)分析研究計(jì)算機(jī)加工的數(shù)據(jù)結(jié)構(gòu)的特性,以便為應(yīng)用涉及的數(shù)據(jù)選擇適合的邏輯結(jié)構(gòu),儲(chǔ)存結(jié)構(gòu)及其相應(yīng)的算法,并初步掌握算法時(shí)間分析和空間分析的技術(shù)。通過實(shí)際操作去了解數(shù)據(jù)結(jié)構(gòu)原理,練習(xí)編寫代碼的能力,以及抽象能力。

  從課程性質(zhì)上講,“數(shù)據(jù)結(jié)構(gòu)”是一門專業(yè)技術(shù)基礎(chǔ)課。它的要求是學(xué)會(huì)分析研究計(jì)算機(jī)加工的數(shù)據(jù)結(jié)構(gòu)的特性,以便為應(yīng)用涉及的數(shù)據(jù)選擇適當(dāng)?shù)倪壿嫿Y(jié)構(gòu),存儲(chǔ)結(jié)構(gòu)及相應(yīng)的算法,并初步掌握算法的時(shí)間分析和空間分析的技術(shù)。另一方面,數(shù)據(jù)結(jié)構(gòu)的學(xué)習(xí)過程也是復(fù)雜程序設(shè)計(jì)的訓(xùn)練過程,要求編寫的程序結(jié)構(gòu)清楚和正確易讀,符合軟件工程的規(guī)范。

  概要設(shè)計(jì)

數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)

  采用鏈?zhǔn)絻?chǔ)存結(jié)構(gòu)。typedef struct LNode{ ElemType data;struct LNode *next;}LNode,*LinkList; 算法設(shè)計(jì)

建立鏈表的算法

(1)算法思想分析

  首先從表尾到表頭逆向建立單鏈表,然后再建立的單鏈表基礎(chǔ)上進(jìn)行對鏈表上的元素進(jìn)行查詢,刪除,插入的操作。(2)要點(diǎn)描述

  首先建立一個(gè)帶頭結(jié)點(diǎn)的單鏈表,通過申請內(nèi)存,先建立一個(gè)空鏈表。然后結(jié)點(diǎn)的插入,建立一個(gè)有多個(gè)結(jié)點(diǎn)的鏈表。在進(jìn)行查詢等操作。(3)時(shí)間和空間復(fù)雜度分析

  程序的時(shí)間復(fù)雜度為O(n)。

鏈表插入一個(gè)元素的算法

(1)算法思想分析

  要生成一個(gè)新數(shù)據(jù)域?yàn)閄的結(jié)點(diǎn),然后插入在單鏈表中。(2)要點(diǎn)描述

  在鏈表中插入結(jié)點(diǎn)只需要修改指針。若要在第 i 個(gè)結(jié)點(diǎn)之前插入元素,修改的是第 i-1 個(gè)結(jié)點(diǎn)的指針。

(3)時(shí)間和空間復(fù)雜度分析

  時(shí)間復(fù)雜度O(n) 鏈表刪除一個(gè)元素的算法

(1)算法思想分析

  要?jiǎng)h除一個(gè)結(jié)點(diǎn),必須修改指針并且釋放空間。(2)要點(diǎn)描述

  找到線性表中第i-1個(gè)結(jié)點(diǎn),修改其指向后繼的指針。

(3)時(shí)間和空間復(fù)雜度分析

  時(shí)間復(fù)雜度O(n)

ADT描述

  aDT LinkList{

  數(shù)據(jù)對象:D={ e | e∈LNode }

  數(shù)據(jù)關(guān)系:R1={ | e∈LNode ,e >0}

  基本操作:

  greateList_L(&L, n)

  操作結(jié)果:構(gòu)造了一個(gè)長為n的數(shù)據(jù)鏈表

  listDelete_L(&L, i, &e)

  初始條件:鏈表L已存在而且非空

  操作結(jié)果:刪除L的第i個(gè)數(shù)據(jù),并且用e返回其值

  listInsert_L(&L, i, e)

  初始條件:鏈表L已存在

  操作結(jié)果: 在L的第i個(gè)位置插入數(shù)據(jù)e

  getElem(L, i, e)

  初始條件:鏈表L已存在

  操作結(jié)果:用e返回L中的第i個(gè)數(shù)據(jù) }ADT LinkList

  詳細(xì)設(shè)計(jì) 數(shù)據(jù)存儲(chǔ)結(jié)構(gòu)設(shè)計(jì)

  采用單鏈?zhǔn)骄€性表實(shí)現(xiàn)

  主要偽代碼

  status GetElem(LinkList L, int i, ElemType *e){ int j=0;int d;LinkList p = L;while(p&&jnext;j++;

} if(!p || j > i)return ERROR;printf(“您要查詢的元素是:n”);d=p->data;printf(“%d”,d);printf(“n”);}

  void InitList(LinkList *L){ *L =(LinkList)malloc(sizeof(struct LNode));if(!*L)exit(OVERFLOW);(*L)->next = NULL;}

  status ListInsert(LinkList L, int i, ElemType e){ int j = 0;LinkList p = L, s;while(p && j < i-1){ p = p->next;j++;} if(!p|| j > i-1)return ERROR;s =(LinkList)malloc(sizeof(struct LNode));s->data = e;s->next = p->next;p->next = s;return OK;}

  status ListDelete(LinkList L, int i, ElemType *e){ int j = 0;LinkList p = L, q;while(p->next && j < i-1){ p = p->next;

  j++;} if(!p->next || j > i-1)return ERROR;q = p->next;p->next = q->next;*e = q->data;free(q);return OK;}

  void ListTraverse(LinkList L, void(*vi)(ElemType)){ LinkList p = L->next;while(p){ vi(p->data);p = p->next;} printf(“n”);}

  void ListPrint(LinkList L){ LinkList p = L->next;while(p){ printf(“%d ”, p->data);p = p->next;} printf(“n”);}

  void printInt(int data){ printf(“%d ”, data);}.軟件測試

  圖一(主界面)

  圖二(插入學(xué)生信息)

  圖三(顯示所有學(xué)生信息)

  圖四(查詢個(gè)人信息)

  圖五(統(tǒng)計(jì)信息)

  圖六(修改信息)

  圖七(保存數(shù)據(jù))

  圖八(刪除信息)

  心得體會(huì)

  通過本程序的設(shè)計(jì),我對數(shù)據(jù)結(jié)構(gòu)作了以下總結(jié):要解決一道程序題必須先要認(rèn)真捕捉改程序中的有用信息,找出解決方法。先規(guī)劃好,程序需要什么樣的數(shù)據(jù)結(jié)構(gòu),什么函數(shù),對程序有什么要求。然后從整體把握對程序設(shè)計(jì)進(jìn)行分工,相應(yīng)地把程序分成若干模塊,具體實(shí)現(xiàn)各部分實(shí)行相應(yīng)的功能。一個(gè)程序要順利地進(jìn)行設(shè)計(jì),一是要對程序的功能有全面的了解,如果漏了某些部分,都會(huì)使得這個(gè)程序調(diào)試不出來或者是令該程序沒有達(dá)到預(yù)想的效果。其次,在程序的編譯中,必須注重程序設(shè)計(jì)過程中的細(xì)節(jié),像單鏈表的程序,就要理解鏈表的概念,理解鏈表的數(shù)據(jù)特點(diǎn),要清楚知道數(shù)據(jù)域和指針域的作用,否則,很容易會(huì)浪費(fèi)大量時(shí)間在檢測錯(cuò)誤上面。要說到解題的思考方向,如果要總結(jié)成規(guī)律,我認(rèn)為要靈活的進(jìn)行方法的設(shè)計(jì),通過不同的方法來實(shí)現(xiàn)不同的功能,如通過結(jié)點(diǎn)的插入來實(shí)現(xiàn)鏈表的創(chuàng)建。同時(shí)應(yīng)該注意各種語句的選擇,要先預(yù)想好需要什么樣的語句來實(shí)現(xiàn)函數(shù)定義,盡量簡單快捷地完成,避免出錯(cuò)。

  要規(guī)范面向?qū)ο蟪绦蛟O(shè)計(jì)師的書寫協(xié)管,在這次課程設(shè)計(jì)中,我們再次感受到,規(guī)范的程序書寫,可以更好的進(jìn)行后期的差錯(cuò)補(bǔ)漏。還應(yīng)該注意各種面向?qū)ο笳Z言語法的運(yùn)用,例如繼承的方法,都要嚴(yán)格按照語法來進(jìn)行,否則很容易就會(huì)出現(xiàn)錯(cuò)誤,甚至嚴(yán)重影響課程設(shè)計(jì)的進(jìn)度。

  源代碼

#include “” #include “” #include “” int shoudsave=0;// struct student {

  char num[10];//學(xué)號(hào)

  char name[20];

  char sex[4];

  int cgrade;

  int mgrade;

  int egrade;

  int totle;

  int ave;

  char neartime[10];//最近更新時(shí)間

};

  typedef struct node {

  struct student data;

  struct node *next;}Node,*Link;

  int menu(){

  char m[3];

  int n;

  printf(“ ************************歡迎進(jìn)入學(xué)生成績管理系統(tǒng)******************************nn”);

  printf(“t歡迎使用本學(xué)生管理系統(tǒng),本系統(tǒng)將為您提供歷史學(xué)生信息查詢,學(xué)生成績信息管理功能。n”);

  printf(“********************************************************************************”);

  printf(“t1輸入學(xué)生資料ttttt2刪除學(xué)生資料n”);

  printf(“t3查詢學(xué)生資料ttttt4修改學(xué)生資料n”);

  printf(“t5顯示學(xué)生資料ttttt6統(tǒng)計(jì)學(xué)生成績n”);

  printf(“t7保存學(xué)生資料n”);

  printf(“ttplease choose a operation(1-7):n”);

  printf(“***********************************************************************

*********n”);

  scanf(“%s”,m);

  n=atoi(m);

  return(n);}

  void printstart(){

  printf(“---------n”);}

  void Wrong(){

  printf(“n=====>提示:輸入錯(cuò)誤!n”);}

  void Nofind(){

  printf(“n=====>提示:沒有找到該學(xué)生!n”);}

  void printc()// 本函數(shù)用于輸出中文

{

  printf(“學(xué)號(hào)t 姓名

  性別

  英語成績 數(shù)據(jù)庫成績 數(shù)據(jù)結(jié)構(gòu)成績

  總分平均分n”);}

  void printe(Node *p)//本函數(shù)用于輸出英文

{

  printf(“%-12s%stt%st%dtt%dt%dt%dt %dn”,p->,p->,p->,p->,p->,p->,p->,p->);}

  node* Locate(Link l,char findmess[],char nameornum[])//該函數(shù)用于定位連表中符合要求的接點(diǎn),并返回該指針

{

  node *r;

  if(strcmp(nameornum,“num”)==0)//按學(xué)號(hào)查詢

{

  r=l->next;

  while(r!=NULL)

{

  if(strcmp(r->,findmess)==0)

  return r;

  r=r->next;

}

}

  else if(strcmp(nameornum,“name”)==0)//按姓名查詢

{

  r=l->next;

  while(r!=NULL)

{

  if(strcmp(r->,findmess)==0)

  return r;

  r=r->next;

}

}

  return 0;}

  void Add(Link l)//增加學(xué)生

{

  node *p,*r,*s;

  char num[10];

  r=l;

  s=l->next;

  while(r->next!=NULL)

  r=r->next;//將指針置于最末尾

  while(1)

{

  printf(“請你輸入學(xué)號(hào)(以'0'返回上一級(jí)菜單:)”);

  scanf(“%s”,num);

  if(strcmp(num,“0”)==0)

  break;

  while(s)

{

  if(strcmp(s->,num)==0)

{

  printf(“=====>提示:學(xué)號(hào)為'%s'的學(xué)生已經(jīng)存在,若要修改請你選擇'4 修改'!n”,num);

  printstart();

  printc();

  printe(s);

  printstart();

  printf(“n”);

  return;

}

  s=s->next;

}

  p=(Node *)malloc(sizeof(Node));

  strcpy(p->,num);

  printf(“請你輸入姓名:”);

  scanf(“%s”,p->);

  getchar();

  printf(“請你輸入性別:”);

  scanf(“%s”,p->);

  getchar();

  printf(“請你輸入數(shù)據(jù)結(jié)構(gòu)成績:”);

  scanf(“%d”,&p->);

  getchar();

  printf(“請你輸入數(shù)據(jù)庫成績:”);

  scanf(“%d”,&p->);

  getchar();

  printf(“請你輸入英語成績:”);

  scanf(“%d”,&p->);

  getchar();

  p->=p->+p->+p->;

  p->=p-> / 3;

//信息輸入已經(jīng)完成p->next=NULL;

  r->next=p;

  r=p;

  shoudsave=1;

} }

  void Qur(Link l)//查詢學(xué)生

{

  char findmess[20];

  node *p;

  if(!l->next)

{

  printf(“n=====>提示:沒有資料可以查詢!n”);

  return;

}

  printf(“請你輸入要查找的學(xué)號(hào):”);

  scanf(“%s”,findmess);

  p=Locate(l,findmess,“num”);

  if(p)

{

  printf(“tttt查找結(jié)果n”);

  printstart();

  printc();

  printe(p);

  printstart();

}

  else

  nofind();}

  void Del(Link l)//刪除

{

  node *p,*r;

  char findmess[20];

  if(!l->next)

{

  printf(“n=====>提示:沒有資料可以刪除!n”);

  return;

}

  printf(“n=====>確定進(jìn)行刪除操作請按 1,按其他按鍵退出該操作nnnn”);

  if(menu()==1)

{

  printf(“請你輸入要?jiǎng)h除的學(xué)號(hào):”);

  scanf(“%s”,findmess);

  p=Locate(l,findmess,“num”);

  if(p)

{

  r=l;

  while(r->next!=p)

  r=r->next;

  r->next=p->next;

  free(p);

  printf(“n=====>提示:該學(xué)生已經(jīng)成功刪除!n”);

  shoudsave=1;

}

  else

  nofind();

}

  else

  exit;}

  void Modify(Link l)//修改函數(shù) {

  node *p;

  char findmess[20];

  if(!l->next)

{

  printf(“n=====>提示:沒有資料可以修改!n”);

  return;

}

  printf(“請你輸入要修改的學(xué)生學(xué)號(hào):”);

  scanf(“%s”,findmess);

  p=Locate(l,findmess,“num”);

  if(p)

{

  printf(“請你輸入新學(xué)號(hào)(原來是%s):”,p->);

  scanf(“%s”,p->);

  printf(“請你輸入新姓名(原來是%s):”,p->);

  scanf(“%s”,p->);

  getchar();

  printf(“請你輸入新性別(原來是%s):”,p->);

  scanf(“%s”,p->);

  printf(“請你輸入新的數(shù)據(jù)結(jié)構(gòu)成績(原來是%d分):”,p->);

  scanf(“%d”,&p->);

  getchar();

  printf(“請你輸入新的數(shù)據(jù)庫成績(原來是%d分):”,p->);

  scanf(“%d”,&p->);

  getchar();

  printf(“請你輸入新的英語成績(原來是%d分):”,p->);

  scanf(“%d”,&p->);

  p->=p->+p->+p->;

  p->=p->/3;

  printf(“n=====>提示:資料修改成功!n”);

  shoudsave=1;

}

  else

  nofind();

}

  void Disp(Link l)//顯示函數(shù) {

  int count=0;

  node *p;

  p=l->next;

  if(!p)

{

  printf(“n=====>提示:沒有資料可以顯示!n”);

  return;

}

  printf(“tttt顯示結(jié)果n”);

  printstart();

  printc();

  printf(“n”);

  while(p)

{

  printe(p);

  p=p->next;

}

  printstart();

  printf(“n”);}

  void Tongji(Link l)//統(tǒng)計(jì)函數(shù) {

  node *pm,*pe,*pc,*pt,*pa;//用于指向分?jǐn)?shù)最高的接點(diǎn)

  node *r=l->next;

  if(!r)

{

  printf(“n=====>提示:沒有資料可以統(tǒng)計(jì)!n”);

  return;

}

  pm=pe=pc=pt=pa=r;

  while(r!=NULL)

{

  if(r->>=pc->)

  pc=r;

  if(r->>=pm->)

  pm=r;

  if(r->>=pe->)

  pe=r;

  if(r->>=pt->)

  pt=r;

  if(r->>=pa->)

  pa=r;

  r=r->next;

}

  printf(“------------------------------統(tǒng)計(jì)結(jié)果-n”);

  printf(“總分最高者:t%s %d分n”,pt->,pt->);

  printf(“平均分最高者:t%s %d分n”,pa->,pa->);

  printf(“英語最高者:t%s %d分n”,pe->,pe->);

  printf(“數(shù)據(jù)庫最高者:t%s %d分n”,pm->,pm->);

  printf(“數(shù)據(jù)結(jié)構(gòu)最高者:t%s %d分n”,pc->,pc->);

  printstart();}

  void Save(Link l)//保存函數(shù) {

  fILE* fp;

  node *p;

  int flag=1,count=0;

  fp=fopen(“c:student”,“wb”);

  if(fp==NULL)

{

  printf(“n=====>提示:重新打開文件時(shí)發(fā)生錯(cuò)誤!n”);

  exit(1);

}

  p=l->next;

  while(p)

{

  if(fwrite(p,sizeof(Node),1,fp)==1)

{

  p=p->next;

  count++;

}

  else

{

  flag=0;

  break;

}

}

  if(flag)

{

  printf(“n=====>提示:文件保存成功.(有%d條記錄已經(jīng)保存.)n”,count);

  shoudsave=0;

}

  fclose(fp);}

  void main(){

  link l;//連表

  fILE *fp;//文件指針

  char ch;

  char jian;

  int count=0;

  node *p,*r;

  l=(Node*)malloc(sizeof(Node));

  l->next=NULL;

  r=l;

  fp=fopen(“C:student”,“rb”);

  if(fp==NULL)

{

  fp=fopen(“C:student”,“wb”);

  exit(0);

}

  printf(“n=====>提示:文件已經(jīng)打開,正在導(dǎo)入記錄......n”);

  while(!feof(fp))

{

  p=(Node*)malloc(sizeof(Node));

  if(fread(p,sizeof(Node),1,fp))//將文件的內(nèi)容放入接點(diǎn)中

{

  p->next=NULL;

  r->next=p;

  r=p;//將該接點(diǎn)掛入連中

  count++;

}

}

  fclose(fp);//關(guān)閉文件

  printf(“n=====>提示:記錄導(dǎo)入完畢,共導(dǎo)入%d條記錄.n”,count);

  for(;;)

{

  switch(menu())

{

  case 1:Add(l);break;//增加學(xué)生

  case 2:Del(l);break;//刪除學(xué)生

  case 3:Qur(l);break;//查詢學(xué)生

  case 4:Modify(l);break;//修改學(xué)生

  case 5:Disp(l);break;//顯示學(xué)生

  case 6:Tongji(l);break;//統(tǒng)計(jì)學(xué)生

  case 7:Save(l);break;//保存學(xué)生

  default: Wrong();

  getchar();

  break;

}

}

}

  參考文獻(xiàn)

《數(shù)據(jù)結(jié)構(gòu)(C語言版)》----------------清華大學(xué)出版社 嚴(yán)蔚敏 吳偉民 編著 《C語言程序設(shè)計(jì)》------------------------中國鐵道出版社 丁峻嶺 余堅(jiān) 編著

圖書管理系統(tǒng)含源代碼c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)報(bào)告3篇 c語言程序設(shè)計(jì)圖書管理系統(tǒng)報(bào)告相關(guān)文章:

砌體結(jié)構(gòu)課程設(shè)計(jì)任務(wù)書3篇 砌體結(jié)構(gòu)課程設(shè)計(jì)任務(wù)書及計(jì)算書

圖書室自評(píng)自查報(bào)告——[精選]3篇(小學(xué)圖書室自查自評(píng)報(bào)告)

大數(shù)據(jù)時(shí)代《人力資源管理》課程內(nèi)容創(chuàng)新研究3篇 人力資源管理迭代創(chuàng)新

[財(cái)務(wù)管理系統(tǒng)設(shè)計(jì)原則和步驟]財(cái)務(wù)管理系統(tǒng)2篇(財(cái)務(wù)系統(tǒng)如何設(shè)計(jì))

省市學(xué)籍系統(tǒng)的數(shù)據(jù)對接工作總結(jié)2篇 學(xué)籍系統(tǒng)學(xué)習(xí)心得體會(huì)

全市黨員發(fā)展結(jié)構(gòu)調(diào)控的調(diào)研報(bào)告2篇(發(fā)展黨員情況調(diào)研)

小學(xué)音樂課程教學(xué)工作計(jì)劃報(bào)告3篇(小學(xué)音樂教師教學(xué)工作計(jì)劃)

關(guān)于大學(xué)課程設(shè)計(jì)心得體會(huì)優(yōu)秀2022【6篇】(大學(xué)生課程設(shè)計(jì)學(xué)習(xí)心得萬能模板)

課程設(shè)計(jì)心得體會(huì)1【12篇】(java課程設(shè)計(jì)心得體會(huì))

課程設(shè)計(jì)心得體會(huì)及總結(jié)3篇 設(shè)計(jì)課程心得體會(huì)范文