程序機房機位預約模擬系統(tǒng)_第1頁
程序機房機位預約模擬系統(tǒng)_第2頁
程序機房機位預約模擬系統(tǒng)_第3頁
程序機房機位預約模擬系統(tǒng)_第4頁
程序機房機位預約模擬系統(tǒng)_第5頁
已閱讀5頁,還剩15頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、精選優(yōu)質(zhì)文檔-傾情為你奉上高級語言程序設計課程設計說明書 設計題目:機房機位預約模擬管理系統(tǒng)設計 目錄1,題目要求22,需求分析33,總體分析34,上機操作105,學習總結126,參考書目12附錄源代碼13C語言程序設計機房機位預約模擬管理系統(tǒng)設計一,題目要求1、數(shù)據(jù)結構 顧客信息結構體: Struct CusInfo Char name20;/顧客姓名 Int sex; /性別 Char tel11; /電話 CInfo; 機位信息結構體: Struct Int State6; /機位狀態(tài),每 2 個小時為一個時間段,08:00-20:00 共 6 個時間段。0 表示有空機位,1 表示沒有空

2、機位 CInfo waitlist6; /各個時間段的運行客戶 Int year; Int month; Int day; /日期 PCInfo; PCInfo info100; /存放 100 天的機位信息 2,具體實現(xiàn)(1)查詢 輸入時間,則遍歷 info 數(shù)組,查看日期(year/month/day),如果日期匹配,則把機位信息輸出。 (2)機位預訂 輸入日期(或時間段)查詢機位信息文件,如果日期符合,再查看狀態(tài)字段,若相應字段為0,則預約(即把該用戶信息加入寫入機位 waitlist 相應時間段中) ;若相應字段為 1,則查看本天其他時間段,尋找最近空時間段。如果用戶要求在非空時間上機

3、,則查找 info 數(shù)組中該時間段為空的元素,把該時間段的狀態(tài)字段設為 1,把用戶信息加入機位當天 waitlist 相應時間段中。 (3)退出預訂 根據(jù)預訂日期和客戶信息找到預訂信息,把客戶信息刪除,并把該時間段的狀態(tài)置為 0。 (4)查詢 輸入日期和時間段,查看該時間段的狀態(tài),如為 1,則把相應時間段的運行客戶信息打 印輸出。如為 0,則顯示“該時間段空閑!?!?二,需求分析根據(jù)題目要求在程序中需實現(xiàn)查詢,預定,排隊等功能的操作,所以需要建立相應的模塊來實現(xiàn);另外還需提供鍵盤式選擇菜單實現(xiàn)功能,在運行時達到所要目的。三,總體分析整個系統(tǒng)可分為3個模塊 查詢模塊 預定模塊 取消模塊機房機位預

4、約模擬系統(tǒng)查詢模塊預定模塊取消模塊詳細設計主函數(shù)模塊 主函數(shù)比較簡潔,只提供輸入、功能處理和輸出部分的函數(shù)調(diào)用。 顯示一系列功能選擇輸入n,判斷m 是否是0到6?根據(jù)n值調(diào)用各功能模塊函數(shù)結束N開始main() int i; for(i=0;i=8&nnext!=NULL;Rem=Rem-next) if(strcmp(Rem-data,Infor)=0)break; if(Rem-locat!=0) printf(The computer number is %dn,Rem-locat); else printf(對不起.你依舊在等待列表中或者沒有預定); else printf(錯誤,請再

5、次輸入.n); void inquir() int n; printf(輸入想要查詢的時間(24 hours 820oclock,include 8 oclock)n); scanf(%d,&n); if(n=8&n20) n=S(n); if(TimeQueuen.CNum=8&n20) n=S(n); if(TimeQueuen.CNumlocat=1; strcpy(Rem-data,Infor); Rem-next=NULL; TimeQueuen.first=Rem; TimeQueuen.last=Rem; TimeQueuen.CNum+; printf(成功預定n); else

6、 Rem=(struct node *)malloc(sizeof(struct node); strcpy(Rem-data,Infor); Rem-next=NULL; p=TimeQueuen.last; Rem-locat=TimeQueuen.CNum+1; printf(%d,Rem-locat); TimeQueuen.last=Rem; p-next=Rem; TimeQueuen.CNum+; printf(成功預定n); else printf(沒有空余機位!); else printf(錯誤.請再次輸入.n); void waiting() int n; char Inf

7、or10; struct node *Rem; struct node *p; printf(請輸入想要排隊的時間n); scanf(%d,&n); if(n=8&n=MAX) printf(請輸入你的學號n); scanf(%s,Infor); if(TimeQueuen.CNum)=MAX) Rem=(struct node *)malloc(sizeof(struct node); strcpy(Rem-data,Infor); Rem-next=NULL; Rem-locat=0; p=TimeQueuen.last; TimeQueuen.last=Rem; p-next=Rem;

8、TimeQueuen.middle=Rem; TimeQueuen.CNum+; printf(成功排隊n); else Rem=(struct node *)malloc(sizeof(struct node); strcpy(Rem-data,Infor); Rem-next=NULL; Rem-locat=0; p=TimeQueuen.last; TimeQueuen.last=Rem; p-next=Rem; TimeQueuen.CNum+; printf(成功排隊n); else printf(有空余機位,無須等待n); else printf(錯誤.再次輸入.n); 開始輸入預

9、定時間 判斷是否預定與排隊成功取消預定結束N取消模塊 void cancel() int n; int i; char Infor10; struct node *Rem; struct node *q; struct node *p; printf(請輸入預定的時間n); scanf(%d,&n); if(n=8&nnext,i+) if(strcmp(Rem-data,Infor)=0)break; if(iMAX) if(Rem-next=NULL) q-next=NULL; TimeQueuen.last=q; free(Rem); TimeQueuen.CNum-; printf(S

10、ucceed to out the queue!n); else q-next=Rem-next; free(Rem); TimeQueuen.CNum-; printf(Succeed to out the queue!n); else if(TimeQueuen.CNumMAX) TimeQueuen.middle-locat=Rem-locat; TimeQueuen.middle=TimeQueuen.middle-next; if(i=1) TimeQueuen.first=Rem-next; else q-next=Rem-next; free(Rem); TimeQueuen.C

11、Num-; printf(成功取消預定!n);四,上機操作(1), 主界面如下:輸入16選擇各個選項進行不同選擇(2),輸入3進入預定界面成功預定出現(xiàn)提示:(3),輸入5查詢等待列表:(4),輸入6時查詢等待者時間列表:(4),錯誤時返回原界面并提示錯誤五,學習總結通過該實例的學習,我重新溫習了C語言的知識,加深了對書上知識的認識與理解,系統(tǒng)地運用已學的知識,擴大了C語言方面的視野。此次實踐讓我進一步理解了運用結構化程序設計的思想和方法,初步掌握了開發(fā)一個小型實用系統(tǒng)的基本方法,不僅摸索出了調(diào)試一個較長程序的的基本方法,而且學會了利用流程圖表示算法,進一步掌握和提高了利用C語言進行程序設計的能

12、力。相信通過此次C語言課程設計所學的知識,在以后我能夠在實際生活中解決所遇到的問題。在學習上機的過程中,我得到的不僅僅是將理論與實踐結合在一起的技巧與方法,而更可貴的是做事情的態(tài)度緩和懂得與人相處的重要性。編寫的程序從理論上來說并未出錯,但一到上機調(diào)試時卻無法運行;即算是課本的問題原封不動地照搬,也可能回得到截然不同的結果不僅如此,這次實踐,是我認識到學好計算機要重視實踐操作,書上的知識弄懂了,不代表會利用計算機運行程序。紙上得來終覺淺,絕知此事要躬行!需要學習的地方還有很多。 六,參考書目c語言程序設計教程 第三版 譚浩強 張基溫 高等教育出版社計算機基礎教程 第三版 周學君 華中科技大學出

13、版社標準c程序設計 E Balagurusamy 清華大學出版社高級語言c+程序設計 第二版 劉璟 周玉龍 高等教育出版社附錄源代碼:#include #include #include #define LENGTH 6 #define MAX 20 #define S(r) (r-8)/2 #define NULL 0 struct node int locat; char data10; struct node *next; ; struct node *head; struct cell int CNum; struct node *first; struct node *middle;

14、 struct node *last; TimeQueueLENGTH; void Inquir() int n; char Infor10; struct node *Rem; printf(輸入查詢時間(24 hours 820 oclock,include 8oclock)n); scanf(%d,&n); if(n=8&nnext!=NULL;Rem=Rem-next) if(strcmp(Rem-data,Infor)=0)break; if(Rem-locat!=0) printf(The computer number is %dn,Rem-locat); else printf

15、(對不起.你依舊在等待列表中或者沒有預定); else printf(錯誤,請再次輸入.n); void inquir() int n; printf(輸入想要查詢的時間(24 hours 820oclock,include 8 oclock)n); scanf(%d,&n); if(n=8&n20) n=S(n); if(TimeQueuen.CNum=8&n20) n=S(n); if(TimeQueuen.CNumlocat=1; strcpy(Rem-data,Infor); Rem-next=NULL; TimeQueuen.first=Rem; TimeQueuen.last=Re

16、m; TimeQueuen.CNum+; printf(成功預定n); else Rem=(struct node *)malloc(sizeof(struct node); strcpy(Rem-data,Infor); Rem-next=NULL; p=TimeQueuen.last; Rem-locat=TimeQueuen.CNum+1; printf(%d,Rem-locat); TimeQueuen.last=Rem; p-next=Rem; TimeQueuen.CNum+; printf(成功預定n); else printf(沒有空余機位!); else printf(錯誤.

17、請再次輸入.n); void waiting() int n; char Infor10; struct node *Rem; struct node *p; printf(請輸入想要排隊的時間n); scanf(%d,&n); if(n=8&n=MAX) printf(請輸入你的學號n); scanf(%s,Infor); if(TimeQueuen.CNum)=MAX) Rem=(struct node *)malloc(sizeof(struct node); strcpy(Rem-data,Infor); Rem-next=NULL; Rem-locat=0; p=TimeQueuen

18、.last; TimeQueuen.last=Rem; p-next=Rem; TimeQueuen.middle=Rem; TimeQueuen.CNum+; printf(成功排隊n); else Rem=(struct node *)malloc(sizeof(struct node); strcpy(Rem-data,Infor); Rem-next=NULL; Rem-locat=0; p=TimeQueuen.last; TimeQueuen.last=Rem; p-next=Rem; TimeQueuen.CNum+; printf(成功排隊n); else printf(有空余

19、機位,無須等待n); else printf(錯誤.再次輸入.n); void cancel() int n; int i; char Infor10; struct node *Rem; struct node *q; struct node *p; printf(請輸入預定的時間n); scanf(%d,&n); if(n=8&nnext,i+) if(strcmp(Rem-data,Infor)=0)break; if(iMAX) if(Rem-next=NULL) q-next=NULL; TimeQueuen.last=q; free(Rem); TimeQueuen.CNum-;

20、printf(Succeed to out the queue!n); else q-next=Rem-next; free(Rem); TimeQueuen.CNum-; printf(Succeed to out the queue!n); else if(TimeQueuen.CNumMAX) TimeQueuen.middle-locat=Rem-locat; TimeQueuen.middle=TimeQueuen.middle-next; if(i=1) TimeQueuen.first=Rem-next; else q-next=Rem-next; free(Rem); TimeQueuen.CNum-; printf(成功取消預定!n); else printf(錯誤,請再次輸入.n); void inquir_waiting() int n; struct node *q; printf(查詢其他等待者的預定時間n); scanf(%d,&n); if(n=8&nMAX) printf(等待列表

溫馨提示

  • 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. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論