2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩24頁未讀 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、<p><b>  課程設計報告</b></p><p>  設 計 題 目: 運動會分數(shù)統(tǒng)計 </p><p>  哈希表查找的設計 </p><p><b>  【設計題目一】</b></p><p><b>  運動會分數(shù)統(tǒng)計</b>&

2、lt;/p><p><b>  任務</b></p><p>  參加運動會有n個學校,學校編號為1……n。比賽分成m個男子項目,和w個女子項目。項目編號為男子1~m,女子m+1~m+w。不同的項目取前五名或前三名積分;取前五名的積分分別為:7、5、3、2、1,前三名的積分分別為:5、3、2;哪些項目取前五名或前三名由學生自己設定。(m<=20,n<=20)&

3、lt;/p><p><b>  功能要求</b></p><p>  1、可以輸入各個項目的前三名或前五名的成績;2、能統(tǒng)計各學??偡郑?、可以按學校編號、學??偡?、男女團體總分排序輸出;4、可以按學校編號查詢學校某個項目的情況;</p><p>  5、可以按項目編號查詢?nèi)〉们叭蚯拔迕膶W校。</p><p>&l

4、t;b>  需求分析</b></p><p>  1、由用戶定義學校的編號、名稱,項目的編號、名稱,并輸入相對應的成績;</p><p>  2、由用戶選擇各個項目取前三名或前五名;</p><p>  3、系統(tǒng)根據(jù)用戶的輸入生成運動會分數(shù)信息相應文件并保存。</p><p><b>  概要設計</b>

5、;</p><p><b>  1、定義數(shù)據(jù)結構</b></p><p><b> ?。?)學校數(shù)據(jù)類型</b></p><p>  typedef struct ItemNode </p><p>  {int item; //該學校獲獎的項目編號</p>

6、;<p>  char i_name[MAX]; //項目名字</p><p>  int record; //項目成績</p><p>  struct ItemNode *next; //鏈域</p><p>  }ItemNode;</p><p>  typedef struc

7、t </p><p>  { int school; //學校編號</p><p>  char school_name[MAX]; //學校名字</p><p>  int shool_score; //學校總分</p><p>  int boys_score;

8、 //男團體總分</p><p>  int girl_score; //女團體總分</p><p>  ItemNode *firstitem; //鏈域指向鏈表中第一個獲獎項目的結點 </p><p><b>  }SCHNode;</b></p><p>

9、;  typedef struct </p><p>  {int school_num; //學??倲?shù) </p><p>  SCHNode school[MAX];</p><p>  }AllSchool;</p><p><b>  (2)項目數(shù)據(jù)類型</b></p><p&g

10、t;  typedef struct SchoolNode</p><p>  { int school; //學校編號</p><p>  char s_name[MAX]; //學校名字</p><p>  int record; //項目成績</p><p>  struct

11、SchoolNode *next; //鏈域</p><p>  }SchoolNode;</p><p>  typedef struct </p><p>  { int item; //項目編號</p><p>  char item_name[MAX]; //項目名字</p>

12、<p>  SchoolNode *firstschool; //鏈域指向鏈表中第一個結點</p><p><b>  }Item;</b></p><p>  typedef struct </p><p>  { int item_num; //項目總數(shù)</p><p>  Item it

13、em[MAX];</p><p>  }AllItems;</p><p><b>  2、模塊與函數(shù)</b></p><p>  運動會分數(shù)統(tǒng)計系統(tǒng)分為四個模塊:信息輸入及統(tǒng)計模塊、信息保存提取模塊、信息排序輸出模塊、信息查詢模塊。</p><p> ?。?)信息輸入及統(tǒng)計模塊函數(shù): void InitList()、v

14、oid Item_Score()、void InputInfo();</p><p> ?。?)信息保存提取模塊函數(shù):void save()、void ReadInfo();</p><p>  (3)信息排序輸出函數(shù):void School_Score()、void Sort_Schoolnum()、void Sort_SchoolScore()、void Sort_ManScore()

15、、void Sort_WomanScore();</p><p> ?。?)信息查詢模塊函數(shù):void FindInfo_SchoolNum()、void FindInfo_SchoolNum()。</p><p>  3、主函數(shù)與各函數(shù)調(diào)用關系結構圖:</p><p><b>  詳細設計</b></p><p>  

16、#include <stdio.h></p><p>  #include <malloc.h></p><p>  #include <stdlib.h></p><p>  #include <string.h></p><p>  #define MAX 100</p>&l

17、t;p>  #define S_SIZE sizeof(SchoolNode)</p><p>  #define I_SIZE sizeof(ItemNode)</p><p>  typedef struct SchoolNode</p><p>  {int school; //學校編號</p><p> 

18、 char s_name[MAX]; //學校名字</p><p>  int record; //項目成績</p><p>  struct SchoolNode *next; //鏈域</p><p>  }SchoolNode;</p><p>  typedef struct </p>

19、<p>  {int item; //項目編號</p><p>  char item_name[MAX]; //項目名字</p><p>  SchoolNode *firstschool; //鏈域指向鏈表中第一個結點</p><p><b>  }Item;</b></p>

20、<p>  typedef struct </p><p>  { int item_num; //項目總數(shù)</p><p>  Item item[MAX];</p><p>  }AllItems;</p><p>  typedef struct ItemNode </p><p>  

21、{int item; //該學校獲獎的項目編號</p><p>  char i_name[MAX]; //項目名字</p><p>  int record; //項目成績</p><p>  struct ItemNode *next; //鏈域</p><p>

22、  }ItemNode;</p><p>  typedef struct </p><p>  { int school; //學校編號</p><p>  char school_name[MAX]; //學校名字</p><p>  int shool_score;

23、 //學??偡?lt;/p><p>  int boys_score; //男團體總分</p><p>  int girl_score; //女團體總分</p><p>  ItemNode *firstitem; //鏈域指向鏈表中第一個獲獎項目的結點 </p><p>&l

24、t;b>  }SCHNode;</b></p><p>  typedef struct </p><p>  {int school_num; //學??倲?shù) </p><p>  SCHNode school[MAX];</p><p>  }AllSchool;</p><p> 

25、 void InitList(AllSchool *as,AllItems *ai) //初始化鏈表</p><p>  {for (int i = 0;i<ai->item_num;i++) //初始化項目鏈表</p><p>  {ai->item[i].item = i+1;</p><p>  strcpy(ai-&g

26、t;item[i].item_name," ");</p><p>  ai->item[i].firstschool = NULL;</p><p><b>  }</b></p><p>  for (int k = 1;k<=as->school_num;k++) //初始化學校鏈表</

27、p><p>  {as->school[k].school = k;</p><p>  strcpy(as->school[k].school_name," ");</p><p>  as->school[k].firstitem = NULL;</p><p>  as->school[k].s

28、hool_score = as->school[k].boys_score = as->school[k].girl_score = 0;</p><p><b>  }</b></p><p>  as->school[0].shool_score = as->school[0].boys_score = as->school[0].g

29、irl_score = 0;</p><p>  strcpy(as->school[0].school_name," ");</p><p><b>  }</b></p><p>  void Item_Score(AllItems *ai,AllSchool *as,int x) //取三前名和前五名的項

30、目</p><p>  {ItemNode *p; SchoolNode *q;</p><p>  int j,num,k; int m = 3,n = 5;</p><p>  char name[MAX];</p><p>  for (int i = 0;i<ai->item_num;i++)</p>

31、<p>  { printf("\n\n\t|-----------------------請輸入第%d個項目編號:",i+1);</p><p>  scanf("%d",&ai->item[i].item);</p><p>  printf("\n\n\t|-----------------------請輸

32、入第%d個項目名字:",i+1);</p><p>  scanf("%s",ai->item[i].item_name);</p><p>  getchar();</p><p>  printf("\n\n\t|-----------------------1.前三名\t2.前五名\n");</p

33、><p>  printf("\n\n\t|-----------------------請選擇:");</p><p>  scanf("%d",&j);</p><p>  if(j!=1&&j!=2)</p><p>  { printf("\n\n\t|-----

34、------------------輸入有誤,請重新選擇:");</p><p>  scanf("%d",&j);</p><p><b>  }</b></p><p>  if (j == 1)</p><p>  {k = 0;m = 3;</p><p

35、><b>  do </b></p><p>  {printf("\n\n\t|-----------------------請輸入第%d名學校編號:",m);</p><p>  scanf("%d",&num);</p><p>  printf("\n\n\t|-----

36、------------------請輸入第%d名學校名字:",m);</p><p>  scanf("%s",name);</p><p>  getchar();</p><p>  q = (SchoolNode *)malloc(S_SIZE);</p><p>  q->school = num

37、;</p><p>  strcpy(q->s_name,name);</p><p>  p = (ItemNode *)malloc(I_SIZE);</p><p>  p->item = ai->item[i].item;</p><p>  strcpy(p->i_name,ai->item[i].it

38、em_name);</p><p>  if(m==3) p->record=q->record = 2;</p><p>  if(m==2) p->record=q->record = 3;</p><p>  if(m==1) p->record=q->record = 5;</p><p>  q-

39、>next = ai->item[i].firstschool;</p><p>  ai->item[i].firstschool = q;</p><p>  p->next = as->school[num].firstitem;</p><p>  as->school[num].firstitem = p;</p&

40、gt;<p>  strcpy(as->school[num].school_name,q->s_name);</p><p>  as->school[num].shool_score=as->school[num].shool_score+p->record;//累計總分</p><p>  if(i+1<=x) as->scho

41、ol[num].boys_score+=p->record; //累計男團體總分</p><p>  else as->school[num].girl_score += p->record; //累計女團體總分</p><p><b>  m--;</b></p><p><b> 

42、 k++;</b></p><p>  if(k == as->school_num)break;</p><p>  } while (m!=0);</p><p><b>  }</b></p><p>  if (j == 2)</p><p>  {k = 0;n =

43、5;</p><p><b>  do </b></p><p>  {printf("\n\n\t|---------請輸入第%d名學校編號:",n);</p><p>  scanf("%d",&num);</p><p>  printf("\n\n\t|

44、---------請輸入第%d名學校名字:",n);</p><p>  scanf("%s",name);</p><p>  getchar();</p><p>  q = (SchoolNode *)malloc(S_SIZE);</p><p>  q->school = num;</p&g

45、t;<p>  strcpy(q->s_name,name);</p><p>  p = (ItemNode *)malloc(I_SIZE);</p><p>  p->item = ai->item[i].item;</p><p>  strcpy(p->i_name,ai->item[i].item_name);

46、</p><p>  if(n == 5) p->record = q->record = 1;</p><p>  if(n == 4) p->record = q->record = 2;</p><p>  if(n == 3) p->record = q->record = 3;</p><p> 

47、 if(n == 2) p->record = q->record = 5;</p><p>  if(n == 1) p->record = q->record = 7;</p><p>  q->next = ai->item[i].firstschool;</p><p>  ai->item[i].firstscho

48、ol = q;</p><p>  p->next = as->school[num].firstitem;</p><p>  as->school[num].firstitem = p;</p><p>  strcpy(as->school[num].school_name,q->s_name);</p><p

49、>  as->school[num].shool_score = as->school[num].shool_score + p->record; //累計總分</p><p>  if(i+1<=x) as->school[num].boys_score += p->record; //累計男團體總分</p><p>  else a

50、s->school[num].girl_score += p->record; //累計女團體總分</p><p><b>  n--;k++;</b></p><p>  if(k == as->school_num)break;</p><p>  } while (n!=0);</p>

51、;<p><b>  }</b></p><p><b>  }</b></p><p><b>  }</b></p><p>  void InputInfo(AllSchool *AS,AllItems *AI)</p><p>  {int m,w;&l

52、t;/p><p>  printf("\n\n\t|***********************輸入各個項目信息***********************|\n\n");</p><p>  printf("\n\n\t|---------請輸入男子項目總數(shù)m:");</p><p>  scanf("%d&quo

53、t;,&m);</p><p>  if(m<0||m>20) </p><p>  { printf("\n\n\t|*********輸入有誤,m是20以內(nèi)的整數(shù),請重新輸入:");</p><p>  scanf("%d",&m);</p><p><b>

54、  }</b></p><p>  printf("\n\n\t|---------請輸入女子項目總數(shù)w:");</p><p>  scanf("%d",&w);</p><p>  if(w<0||w>20) </p><p>  { printf("\n

55、\n\t|*********輸入有誤,w是20以內(nèi)的整數(shù),請重新輸入:");</p><p>  scanf("%d",&w);</p><p><b>  }</b></p><p>  printf("\n\n\t|---------請輸入?yún)⒓舆\動會的學??倲?shù)n:");</p&

56、gt;<p>  scanf("%d",&AS->school_num);</p><p>  if (AS->school_num < 0 || AS->school_num > 20)</p><p>  {printf("\n\n\t|*********輸入有誤,n是20以內(nèi)的整數(shù),請重新輸入:&qu

57、ot;);</p><p>  scanf("%d",&AS->school_num);</p><p><b>  }</b></p><p>  AI->item_num = m+w;</p><p>  printf("\n\t則項目編號為男子1—%d,女子%d—%

58、d",m,m+1,AI->item_num);</p><p>  InitList(AS,AI); //初始化鏈表</p><p>  Item_Score(AI,AS,m); //區(qū)分取前名和前名的項目給分情況</p><p><b>  }</b></p><p>  void save(Al

59、lItems *ai,AllSchool *as) //存儲數(shù)據(jù)文件</p><p>  { FILE *fp1,*fp2;</p><p>  if((fp1=fopen("AllItems.txt","w+"))==NULL)</p><p>  { printf("\n\n\t|------

60、-----------------創(chuàng)建文件失??!-----------------------|\n"); return;</p><p><b>  }</b></p><p>  if(fwrite(ai,sizeof(AllItems),1,fp1)!=1)</p><p>  printf("\n\n\t|-----

61、-------------------保存信息失??!-----------------------|\n");</p><p><b>  else</b></p><p>  printf("\n\n\t|-------------------信息成功保存到AllItems.txt!--------------|\n");</p&

62、gt;<p>  fclose(fp1);</p><p>  if((fp2=fopen("AllSchool.txt","w+"))==NULL)</p><p>  { printf("\n\n\t|-----------------------創(chuàng)建文件失??!-----------------------|\n&q

63、uot;); return;</p><p><b>  }</b></p><p>  if(fwrite(as,sizeof(AllSchool),1,fp2)!=1)</p><p>  printf("\n\n\t|------------------------保存信息失??!-----------------------|\

64、n");</p><p><b>  else</b></p><p>  printf("\n\n\t|-------------------信息成功保存到AllSchool.txt!-------------|\n");</p><p>  fclose(fp2);</p><p>  

65、system("pause");</p><p><b>  }</b></p><p>  void ReadInfo(AllSchool *as,AllItems *ai) //讀取文件信息</p><p>  {FILE *fp1,*fp2;</p><p>  if ((fp1 =

66、fopen("AllItems.txt","r")) == NULL)</p><p>  {printf("\n\n\t|-------------------找不到文件AllItems.txt!------------------|\n");</p><p>  system("pause");retur

67、n ;</p><p><b>  }</b></p><p>  fread(ai,sizeof(AllItems),1,fp1);</p><p>  printf("\n\n\t|-----------------AllItems.txt文件內(nèi)容讀取完畢!--------------|\n");</p>

68、<p>  fclose(fp1);</p><p>  if ((fp2 = fopen("AllSchool.txt","r")) == NULL)</p><p>  {printf("\n\n\t|-------------------找不到文件AllSchool.txt!------------------|\n&qu

69、ot;);</p><p>  system("pause");return ;</p><p><b>  }</b></p><p>  fread(as,sizeof(AllSchool),1,fp2);</p><p>  printf("\n\n\t|---------------

70、--AllSchool.txt文件內(nèi)容讀取完畢!-------------|\n");</p><p>  fclose(fp2);</p><p>  system("pause");</p><p><b>  }</b></p><p>  void School_Score(AllS

71、chool *as) //統(tǒng)計學??偡?lt;/p><p>  {printf("\n\n\t|***********************輸出各個學??偟梅?**********************|\n");</p><p>  printf("\t|----------------------------------------------

72、------------------|\n");</p><p>  printf("\t|---- 學校編號\t|學校名字 |男團體總分|女團體總分|總分 |------|\n");</p><p>  printf("\t|---------------------------------------------------------

73、-------|\n");</p><p>  for (int i = 1;i<=as->school_num;i++)</p><p>  {printf("\t|---- %-9d|%-8s |%-4d\t|%-10d|%-8d|----|\n",i,as->school[i].school_name,as->schoo

74、l[i].boys_score,as->school[i].girl_score,as->school[i].shool_score);</p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p><b>  

75、}</b></p><p>  printf("\n\n");system("pause");</p><p><b>  }</b></p><p>  void Sort_Schoolnum(AllSchool *as) //按學校編號排序</p><p>

76、;  {printf("\n\n\t|***********************按學校編號排序輸出***********************|\n");</p><p>  printf("\t|----------------------------------------------------------------|\n");</p><

77、;p>  printf("\t|---- 學校編號\t|學校名字 |男團體總分|女團體總分|總分 |------|\n");</p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p>  for

78、 (int i = 1;i<=as->school_num;i++)</p><p>  {printf("\t|---- %-9d|%-8s |%-4d\t|%-10d|%-8d|----|\n",i,as->school[i].school_name,as->school[i].boys_score,as->school[i].girl_score,

79、as->school[i].shool_score);</p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p><b>  }</b></p><p>  printf(&qu

80、ot;\n\n");system("pause");</p><p><b>  }</b></p><p>  void Sort_SchoolScore(AllSchool *as) //按學??偡峙判?直接插入排序)</p><p>  {int i,j,k;</p><p&

81、gt;  printf("\n\n\t|*********************按學??偡峙判蜉敵?************************|\n");</p><p>  printf("\t|----------------------------------------------------------------|\n");</p><

82、;p>  printf("\t|---- 學校編號\t|學校名字 |男團體總分|女團體總分|總分 |------|\n");</p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p>  for

83、 (i = 2;i<as->school_num;i++)</p><p>  {as->school[0].boys_score = as->school[i].boys_score;</p><p>  as->school[0].girl_score = as->school[i].girl_score;</p><p>

84、;  as->school[0].shool_score = as->school[i].shool_score;</p><p>  as->school[0].school = as->school[i].school;</p><p>  strcpy(as->school[0].school_name,as->school[i].school_n

85、ame);</p><p>  j = i - 1;</p><p>  while (as->school[0].shool_score < as->school[j].shool_score && j >0)</p><p>  {as->school[j+1].boys_score = as->school

86、[j].boys_score;</p><p>  as->school[j+1].girl_score = as->school[j].girl_score;</p><p>  as->school[j+1].shool_score = as->school[j].shool_score;</p><p>  as->school

87、[j+1].school = as->school[j].school;</p><p>  strcpy(as->school[j+1].school_name,as->school[j].school_name);</p><p><b>  j--;</b></p><p><b>  }</b>&

88、lt;/p><p>  as->school[j+1].boys_score = as->school[0].boys_score;</p><p>  as->school[j+1].girl_score = as->school[0].girl_score;</p><p>  as->school[j+1].shool_score

89、= as->school[0].shool_score;</p><p>  as->school[j+1].school = as->school[0].school;</p><p>  strcpy(as->school[j+1].school_name,as->school[0].school_name);</p><p>&l

90、t;b>  }</b></p><p>  for (k = 1;k<=as->school_num;k++)</p><p>  {printf("\t|---- %-9d|%-8s |%-4d\t|%-10d|%-8d|----|\n",as->school[k].school,as->school[k].scho

91、ol_name,as->school[k].boys_score,as->school[k].girl_score,as->school[k].shool_score);</p><p>  printf("\t|----------------------------------------------------------------|\n");</p>

92、<p><b>  }</b></p><p>  printf("\n\n");system("pause");</p><p><b>  }</b></p><p>  void Sort_ManScore(AllSchool *as) //按男團體總分

93、排序(直接插入排序)</p><p>  {int i,j,k;</p><p>  printf("\n\n\t|*********************按男團體總分排序輸出***********************|\n");</p><p>  printf("\t|----------------------------

94、------------------------------------|\n");</p><p>  printf("\t|---- 學校編號\t|學校名字 |男團體總分|女團體總分|總分 |------|\n");</p><p>  printf("\t|---------------------------------------

95、-------------------------|\n");</p><p>  for (i = 2;i<=as->school_num;i++)</p><p>  {as->school[0].boys_score = as->school[i].boys_score;</p><p>  as->school[0]

96、.girl_score = as->school[i].girl_score;</p><p>  as->school[0].shool_score = as->school[i].shool_score;</p><p>  as->school[0].school = as->school[i].school;</p><p>

97、  strcpy(as->school[0].school_name,as->school[i].school_name);</p><p>  j = i - 1;</p><p>  while (as->school[0].boys_score < as->school[j].boys_score && j >0)</p>

98、;<p>  {as->school[j+1].boys_score = as->school[j].boys_score;</p><p>  as->school[j+1].girl_score = as->school[j].girl_score;</p><p>  as->school[j+1].shool_score = as-&

99、gt;school[j].shool_score;</p><p>  as->school[j+1].school = as->school[j].school;</p><p>  strcpy(as->school[j+1].school_name,as->school[j].school_name);</p><p><b>

100、;  j--;</b></p><p><b>  }</b></p><p>  as->school[j+1].boys_score = as->school[0].boys_score;</p><p>  as->school[j+1].girl_score = as->school[0].girl

101、_score;</p><p>  as->school[j+1].shool_score = as->school[0].shool_score;</p><p>  as->school[j+1].school = as->school[0].school;</p><p>  strcpy(as->school[j+1].scho

102、ol_name,as->school[0].school_name);</p><p><b>  }</b></p><p>  for (k = 1;k<=as->school_num;k++)</p><p>  {printf("\t|---- %-9d|%-8s |%-4d\t|%-10d|%-8

103、d|----|\n",as->school[k].school,as->school[k].school_name,as->school[k].boys_score,as->school[k].girl_score,as->school[k].shool_score);</p><p>  printf("\t|--------------------------

104、--------------------------------------|\n");</p><p><b>  }</b></p><p>  printf("\n\n");system("pause");</p><p><b>  }</b></p>

105、<p>  void Sort_WomanScore(AllSchool *as) //按女團體總分排序(直接插入排序)</p><p>  {int i,j,k;</p><p>  printf("\n\n\t|*********************按女團體總分排序輸出***********************|\n");</

106、p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p>  printf("\t|---- 學校編號\t|學校名字 |男團體總分|女團體總分|總分 |------|\n");</p><

107、p>  printf("\t|----------------------------------------------------------------|\n");</p><p>  for (i = 2;i<=as->school_num;i++)</p><p>  {as->school[0].boys_score = as-&g

108、t;school[i].boys_score;</p><p>  as->school[0].girl_score = as->school[i].girl_score;</p><p>  as->school[0].shool_score = as->school[i].shool_score;</p><p>  as->sc

109、hool[0].school = as->school[i].school;</p><p>  strcpy(as->school[0].school_name,as->school[i].school_name);</p><p>  j = i - 1;</p><p>  while (as->school[0].girl_score

110、 < as->school[j].girl_score && j >0)</p><p>  {as->school[j+1].boys_score = as->school[j].boys_score;</p><p>  as->school[j+1].girl_score = as->school[j].girl_scor

111、e;</p><p>  as->school[j+1].shool_score = as->school[j].shool_score;</p><p>  as->school[j+1].school = as->school[j].school;</p><p>  strcpy(as->school[j+1].school_na

112、me,as->school[j].school_name);</p><p><b>  j--;</b></p><p><b>  }</b></p><p>  as->school[j+1].boys_score = as->school[0].boys_score;</p><

113、;p>  as->school[j+1].girl_score = as->school[0].girl_score;</p><p>  as->school[j+1].shool_score = as->school[0].shool_score;</p><p>  as->school[j+1].school = as->school[0

114、].school;</p><p>  strcpy(as->school[j+1].school_name,as->school[0].school_name);</p><p><b>  }</b></p><p>  for (k = 1;k<=as->school_num;k++)</p><

115、;p>  {printf("\t|---- %-9d|%-8s |%-4d\t|%-10d|%-8d|----|\n",as->school[k].school,as->school[k].school_name,as->school[k].boys_score,as->school[k].girl_score,as->school[k].shool_score);<

116、;/p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p><b>  }</b></p><p>  printf("\n\n");system("pause

117、");</p><p><b>  }</b></p><p>  void FindInfo_SchoolNum(AllSchool *as) //按學校編號查詢學校某個項目情況</p><p>  {int i,j,k=0; ItemNode *p2;</p><p>  printf(&q

118、uot;\n\n\t|*****************按學校編號查詢學校某個項目情況*****************|\n");</p><p>  printf("\n\t輸入要查詢的學校編號:");</p><p>  scanf("%d",&i); </p><p>  printf("

119、\n\t輸入要查詢的項目編號:");</p><p>  scanf("%d",&j); </p><p>  getchar();</p><p>  p2=as->school[i].firstitem;</p><p>  while(p2!=NULL)</p><p>

120、;  { if(p2->item==j)</p><p><b>  {</b></p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p>  printf("\t|

121、---- 學校編號\t|項目編號 |項目名字 |項目得分|-------|\n");</p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p>  printf("\t|---- %-9d|%-4d\t|%

122、-10s|%-8d|----|\n",i,p2->item,p2->i_name,p2->record);</p><p>  printf("\t|----------------------------------------------------------------|\n");</p><p><b>  k++;<

123、;/b></p><p><b>  }</b></p><p>  p2=p2->next;</p><p><b>  }</b></p><p>  printf("\n");</p><p>  if(k==0) printf(&quo

124、t;\n\t您所查的學校在該項目中沒有取得成績!\n");</p><p>  getchar();</p><p><b>  }</b></p><p>  void FindInfo_SchoolNum(AllItems *ai) //按項目編號查詢?nèi)〉妹蔚膶W校</p><p>  {Sc

125、hoolNode *p;</p><p><b>  int num;</b></p><p>  printf("\n\n\t|***************按項目編號查詢?nèi)〉妹蔚膶W校************|\n");</p><p>  printf("\n\n\t輸入要查詢的項目編號:");&l

126、t;/p><p>  scanf("%d",&num);</p><p>  getchar();</p><p>  if (num > ai->item_num)</p><p>  {printf("\t該項目不存在!");return ;</p><p>

127、;<b>  }</b></p><p>  p = ai->item[num-1].firstschool;</p><p>  printf("\t在項目%s中取得名次的學校依次為:\n",ai->item[num-1].item_name);</p><p>  printf("\t|------

128、-------------------------------------------------|\n");</p><p>  printf("\t|---- 學校編號\t|學校名字 |項目得分|------------------|\n");</p><p>  printf("\t|--------------------------

129、-----------------------------|\n");</p><p>  while (p!=NULL)</p><p>  {printf("\t|---- %-9d|%-8s |%-8d|----|\n",p->school,p->s_name,p->record);</p><p> 

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論