計算機程序設計基礎課程設計報告_第1頁
已閱讀1頁,還剩12頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、<p>  計算機程序設計基礎課程設計報告</p><p>  學院: 城鄉(xiāng)資源與規(guī)劃學院 專業(yè): 城市規(guī)劃 </p><p>  日期:2013 年 6 月 15 日</p><p><b>  目 錄</b></p><p>  1、課程設計題目3</p>

2、<p>  2、課程設計要求3</p><p>  3、設計題目分析3</p><p><b>  3.1題目簡介3</b></p><p><b>  3.2設計要求3</b></p><p>  4、課程設計內容3</p><p><b> 

3、 4.1總體設計3</b></p><p><b>  4.2詳細設計4</b></p><p>  4.3調試和測試7</p><p>  5、設計心得與總結7</p><p><b>  6、建議8</b></p><p><b>  7、

4、附件:9</b></p><p><b>  1、課程設計題目</b></p><p>  建立一個班級(20個學生)的學生情況表(采用鏈表),每個學生的數(shù)據(jù)包括學號、姓名、性別和二門課的成績。</p><p><b>  2、課程設計要求</b></p><p>  1、要求按規(guī)定的

5、時間完成;</p><p>  2、要求按照題目的要求完成程序的編寫,且排版合理,整體整齊,并用C++6.0運行;3、設計報告要求格式正確,要素完整,層次清楚,思路清晰,文字流暢。</p><p><b>  3、設計題目分析</b></p><p><b>  3.1題目簡介</b></p><p&g

6、t;  在學習大學計算機鏈表之后,為了更加熟練的運用之前所學的計算機技能,更好的鍛煉同學們的計算機編程和操作能力,在經(jīng)過這次課程設計后,可以充分的了解到同學們的計算機能力。因此,特開展此次課程設計。</p><p><b>  3.2設計要求</b></p><p>  在建立的程序中,要求建立一個主函數(shù)和一個菜單函數(shù),主函數(shù)要求包含:鏈表的建立,鏈表的插入,鏈表的刪

7、除,鏈表的輸出和鏈表的查找等。</p><p><b>  4、課程設計內容</b></p><p><b>  4.1總體設計</b></p><p> ?。ㄏ到y(tǒng)總體設計框架、系統(tǒng)功能模塊圖)</p><p><b>  4.2詳細設計</b></p><

8、p> ?。ㄖ饕δ苣K的算法設計思路、工作流程圖)</p><p><b>  主函數(shù):</b></p><p><b>  菜單函數(shù):</b></p><p><b>  鏈表的創(chuàng)建:</b></p><p><b>  鏈表的輸出:</b><

9、;/p><p><b>  鏈表的查找:</b></p><p><b>  鏈表的刪除:</b></p><p><b>  鏈表的插入:</b></p><p><b>  4.3調試和測試</b></p><p> ?。ǔ绦蛘{試過

10、程、數(shù)據(jù)測試結果分析,測試過程中遇到的主要問題以及采取的解決措施)</p><p>  剛開始拿到這個題目時,經(jīng)過老師的簡單介紹,對其有一點點了解,于是把所需的函數(shù)輸入了程序,然后再對相應的變量進行修改。試著運行,但是發(fā)現(xiàn)這樣的困難較大,于是把函數(shù)分開來,一個一個的改,一個個的做,直到每個函數(shù)都符合要求之后,再整體的合在一起,再試著運行,發(fā)現(xiàn)還是有問題,于是對主函數(shù)進行修改,以及菜單函數(shù)進行修改,最后都可以運行時

11、,再輸入數(shù)據(jù),驗證程序的可行性。有問題,再繼續(xù)修改,反復多次,并詢問老師,最后確定函數(shù)。最后結合做出的程序,再進行一定的調試,讓它更方便使用和更容易被使用。</p><p><b>  5、設計心得與總結</b></p><p>  (課程設計過程中的學習體會和收獲,對C語言和本次課程設計的認識)</p><p>  在這次課程設計中,我明白了

12、,對于這種由多個函數(shù)組成的綜合性程序,為了更好更快的達到想要的結果,可以先對分函數(shù)進行符合要求的調整,再把所有的函數(shù)整合起來進行調整,修改主函數(shù)、菜單函數(shù)。這樣由總到分再到總的做法,可以清晰明了的找出錯誤點和需修改點。</p><p>  還有一點就是,再做課程設計時,不能孤立自己的去完成,而是在不懂的時候主動找老師同學們進行咨詢,再把東西轉為自己的東西,這樣才能提高自己的動手設計程序的水平,經(jīng)過老師和同學的共同

13、協(xié)作,才能更好的完成課程設計。</p><p>  經(jīng)過這次的課程設計,大大的提高了我的動手能力,和讀程序的能力,讓我更好的掌握了這門課程。同時,也讓我看到了自己的很多不足之處,例如:程序的輸入速度和準確度;對程序的認識度;對程序函數(shù)的運用度等,都需要很大的提高。</p><p><b>  6、建議</b></p><p><b>

14、  7、附件:</b></p><p>  #include<stdio.h></p><p>  #include<stdlib.h></p><p>  #include<conio.h></p><p>  struct student</p><p><b&

15、gt;  {</b></p><p>  char name[20];</p><p>  long int num;</p><p>  int score1,score2;</p><p><b>  char sex;</b></p><p>  struct student *

16、next;</p><p><b>  };</b></p><p><b>  int n;</b></p><p><b>  long num;</b></p><p>  struct student *head=NULL,*stu;</p><p&

17、gt;  struct student *creat()</p><p><b>  {</b></p><p>  struct student *head,*p,*q;</p><p><b>  n=0;</b></p><p>  head=NULL;</p><p>

18、;  p=q=(struct student *)malloc(sizeof(struct student));</p><p><b>  do{</b></p><p>  printf("enter date(input 0 for end):\n");</p><p>  printf("please in

19、put Student num:");</p><p>  scanf("%ld%*c", &p->num);</p><p>  if (0 == p->num)</p><p><b>  break;</b></p><p>  printf("pleas

20、e input Student name:");</p><p>  scanf("%s", &p->name);</p><p>  printf("please input Student score1:");</p><p>  scanf("%d", &p->s

21、core1);</p><p>  printf("please input Student score2:");</p><p>  scanf("%d", &p->score2);</p><p>  printf("please input Student sex(m/w):");<

22、;/p><p>  scanf("%*c%c%*c", &p->sex);</p><p><b>  n++;</b></p><p><b>  if(n==1)</b></p><p><b>  {</b></p><p

23、><b>  head=p;</b></p><p>  head->next=NULL;</p><p><b>  }</b></p><p><b>  else</b></p><p>  q->next=p;</p><p>

24、<b>  q=p;</b></p><p>  p=(struct student *)malloc(sizeof(struct student));</p><p>  }while(p->num!=0);</p><p>  q->next=NULL;</p><p>  return(head);&l

25、t;/p><p><b>  }</b></p><p>  struct student *insert(struct student *head)</p><p><b>  {</b></p><p>  struct student *p0,*p1,*p2;</p><p&g

26、t;  struct student *stud = (struct student *)malloc(sizeof(struct student));</p><p>  printf("please input Student num:");</p><p>  scanf("%ld%*c", &stud->num);</p&

27、gt;<p>  printf("please input Student name:");</p><p>  scanf("%s", &stud->name);</p><p>  printf("please input Student score1:");</p><p>

28、;  scanf("%d", &stud->score1);</p><p>  printf("please input Student score2:");</p><p>  scanf("%d", &stud->score2);</p><p>  printf(&quo

29、t;please input Student sex(m/w):");</p><p>  scanf("%*c%c%*c", &stud->sex);</p><p>  p0 = head;</p><p>  while( p0->next ){</p><p>  p0 = p0-&g

30、t;next;</p><p><b>  }</b></p><p>  p0->next = stud;</p><p>  stud->next = NULL;</p><p>  return head;</p><p><b>  }</b></p

31、><p>  struct student *delete(struct student *head,long num)</p><p><b>  {</b></p><p>  struct student *p1,*p2;</p><p>  if(head==NULL)</p><p><

32、;b>  {</b></p><p>  printf("\nlist null!\n");</p><p>  return NULL;</p><p><b>  }</b></p><p><b>  p1=head;</b></p><

33、;p>  while(num!=p1->num&&p1->next!=NULL)</p><p><b>  {</b></p><p><b>  p2=p1;</b></p><p>  p1=p1->next;</p><p><b>  }&

34、lt;/b></p><p>  if(num==p1->num)</p><p><b>  {</b></p><p>  if(p1==head)</p><p>  head=p1->next;</p><p><b>  else</b></

35、p><p>  p2->next=p1->next;</p><p>  printf("delete:%ld\n",num);</p><p><b>  free(p1);</b></p><p><b>  n--;</b></p><p>

36、<b>  }</b></p><p><b>  else</b></p><p>  printf("%ld not been found!\n",num);</p><p>  return(head);</p><p><b>  }</b><

37、/p><p>  void print(struct student *head)</p><p><b>  {</b></p><p>  struct student *p;</p><p><b>  p=head;</b></p><p>  if(head!=NULL

38、)</p><p><b>  {</b></p><p>  printf("\n\n| Student Num | | Student Name | | Score1 | | Score2 | | sex |\n");</p><p><b>  do{</b></p>

39、<p>  printf("| %11ld | | %12s | | %6d | | %6d | | %c |\n",p->num,p->name,p->score1,p->score2,p->sex);</p><p>  p=p->next;</p><p><b>  }</b&g

40、t;</p><p>  while(p!=NULL);</p><p><b>  }</b></p><p><b>  else</b></p><p>  printf("this is a NULL list");</p><p><b&g

41、t;  }</b></p><p>  struct student *find(struct student *head,long num)</p><p><b>  {</b></p><p>  struct student *p1,*p2;</p><p>  if(head==NULL)</

42、p><p><b>  {</b></p><p>  printf("\n list null!\n");</p><p>  return NULL;</p><p><b>  }</b></p><p><b>  p1=head;</

43、b></p><p>  while(p1!=NULL&&p1->num!=num)</p><p><b>  {</b></p><p>  p1=p1->next;</p><p><b>  }</b></p><p>  if(p1

44、!=NULL)</p><p><b>  {</b></p><p>  printf("Find:");</p><p>  printf("Stu Num:%ld\nStu name:%s\nStu sco1:%d\nStu sco2:%d\nStu sex:%c\n",p1->num,p1-

45、>name,p1->score1,p1->score2,p1->sex);</p><p><b>  }</b></p><p><b>  else</b></p><p>  printf("%ld not been found!\n",num);</p>&

46、lt;p>  return(head);</p><p><b>  }</b></p><p>  int main()</p><p><b>  {</b></p><p>  struct student *stud;</p><p>  int menu();

47、</p><p><b>  while(1)</b></p><p><b>  {</b></p><p>  switch(menu())</p><p><b>  {</b></p><p><b>  case 1:</b&g

48、t;</p><p>  head=creat();</p><p><b>  break;</b></p><p><b>  case 2:</b></p><p>  head = insert(head);</p><p>  printf("\n\tco

49、ntinue!");</p><p><b>  break;</b></p><p><b>  case 3:</b></p><p>  scanf("%d%*c",&num);</p><p>  delete(head, num);</p>

50、<p>  printf("\n\tcontinue!");</p><p><b>  break;</b></p><p><b>  case 4:</b></p><p>  print(head);</p><p>  printf("\n\tc

51、ontinue!");</p><p><b>  getch();</b></p><p><b>  break;</b></p><p><b>  case 5:</b></p><p>  printf("Please input find num

52、:");</p><p>  scanf("%d%*c",&num);</p><p>  find(head, num);</p><p>  printf("\n\tcontinue!");</p><p><b>  getch();</b></p&g

53、t;<p><b>  break;</b></p><p><b>  case 6:</b></p><p><b>  clrscr();</b></p><p><b>  case 7:</b></p><p><b> 

54、 exit(0);</b></p><p><b>  }</b></p><p><b>  }</b></p><p><b>  }</b></p><p>  int menu()</p><p><b>  {</b

55、></p><p>  char d[7];</p><p><b>  int c;</b></p><p>  printf("\n\n%16s"," ");</p><p>  printf("*****menu*****\n\n");</p&

56、gt;<p>  printf("\t\t1.creat list\n");</p><p>  printf("\t\t2.insert list\n");</p><p>  printf("\t\t3.delete list\n");</p><p>  printf("\t\

57、t4.print list\n");</p><p>  printf("\t\t5.find list\n");</p><p>  printf("\t\t6.clrscr\n");</p><p>  printf("\t\t7.exit\n");</p><p>&

58、lt;b>  do{</b></p><p>  printf("\n\tenter select(1-7): ");</p><p><b>  gets(d);</b></p><p>  c=atoi(d);</p><p><b>  }</b><

溫馨提示

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

評論

0/150

提交評論