C課程方案設(shè)計(jì)書報(bào)告(學(xué)生上機(jī)管理系統(tǒng))_第1頁
C課程方案設(shè)計(jì)書報(bào)告(學(xué)生上機(jī)管理系統(tǒng))_第2頁
免費(fèi)預(yù)覽已結(jié)束,剩余16頁可下載查看

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、封面作者: PanHongliang僅供個(gè)人學(xué)習(xí)學(xué)生上機(jī)管理系統(tǒng)1. 需求分析1.1 實(shí)現(xiàn)的目標(biāo)課程設(shè)計(jì)的任務(wù):制作一個(gè)小型的學(xué)生上機(jī)管理系統(tǒng),要求制作一個(gè)菜單,實(shí)現(xiàn)數(shù)據(jù)的錄入,數(shù) 據(jù)的顯示,數(shù)據(jù)查找,數(shù)據(jù)的刪除,數(shù)據(jù)的保存,數(shù)據(jù)的統(tǒng)計(jì),數(shù)據(jù)的修改, 系統(tǒng)的退出。系統(tǒng)的設(shè)計(jì)要求用到 C+C+面向?qū)ο蟮某绦蛟O(shè)計(jì),要求用到類來實(shí) 現(xiàn),同時(shí)每一個(gè)功能用到一個(gè)函數(shù)?;竟δ埽簩W(xué)生基本信息(學(xué)號(hào),姓名,上機(jī)對應(yīng)的設(shè)備編號(hào),設(shè)備名稱,設(shè)備狀態(tài))擴(kuò)展功能:學(xué)生數(shù)據(jù)的添加、修改、與刪除學(xué)生數(shù)據(jù)的讀取與存儲(chǔ)系統(tǒng)特點(diǎn):系統(tǒng)要能夠?qū)ο鄳?yīng)的數(shù)據(jù)進(jìn)行很好的測試,系統(tǒng)的統(tǒng)計(jì)對設(shè)備的狀態(tài),人 數(shù)都進(jìn)行了統(tǒng)計(jì);系統(tǒng)數(shù)據(jù)的錄入

2、除可以手工錄入外,還可以采用文件的錄入;系統(tǒng)統(tǒng)計(jì)學(xué)生的基本信息較全面,包括學(xué)號(hào),姓名;程序中查找運(yùn)用了兩 種查找方式即學(xué)號(hào)查找和姓名查找。1.2 系統(tǒng)實(shí)現(xiàn)方案第一步:分析題目,建立類并派生出它的子類,畫出類圖。第二步:畫出流程,根據(jù)流程圖編寫程序清單第三步:上機(jī)調(diào)試程序(使用單步調(diào)試,設(shè)置斷點(diǎn)、分塊調(diào)試的方法)。第五步:及時(shí)整理資料,撰寫課程設(shè)計(jì)報(bào)告中有關(guān)這個(gè)題目的內(nèi)容。1.3 界面設(shè)計(jì)與數(shù)據(jù)程序?qū)W(xué)生上機(jī)據(jù)處理要求1能夠輸入并瀏覽學(xué)生的基本信息;2能夠?qū)崿F(xiàn)對學(xué)生信息的查詢和修改;3能夠?qū)Τ煽冞M(jìn)行統(tǒng)計(jì);4能夠?qū)W(xué)號(hào)排序。5能夠?qū)W(xué)生的信息進(jìn)行保存;現(xiàn)行的系統(tǒng)功能:資料維護(hù):系統(tǒng)維護(hù)包括對各學(xué)生

3、信息和成績的錄入操作。資料維護(hù):對數(shù)據(jù)表中的信息進(jìn)行瀏覽。系統(tǒng)查詢:可以對學(xué)生的姓名,學(xué)號(hào),設(shè)備信息來查詢。1類設(shè)計(jì)類:student數(shù)據(jù)成員學(xué)號(hào),姓名,性別,設(shè)備編號(hào),設(shè)備名稱類:school成員函數(shù)錄入函數(shù)統(tǒng)計(jì)函數(shù)查詢函數(shù)修改函數(shù)統(tǒng)計(jì)函數(shù)排序函數(shù)刪除函數(shù)輸出函數(shù)UML 圖:Input():輸入編號(hào)到計(jì)算機(jī)的成績;count():統(tǒng)計(jì)各科的總成績,計(jì)算平均成績,統(tǒng)計(jì)各科的及格率;found():按學(xué)號(hào)或姓名查找學(xué)生的記錄; mend():修改指定學(xué)號(hào)學(xué)生成績記錄;ncount():統(tǒng)計(jì)學(xué)生人數(shù);sort():按學(xué)號(hào)排序;del():刪除指定學(xué)號(hào)學(xué)生記錄;show():輸出班級(jí)所有學(xué)生成績記錄

4、;編號(hào)查詢3.詳細(xì)設(shè)計(jì)school+school()+school()+ input():void+ mend():void+ del():void+ find:int+found():void+ show():void+ count():void+sort():void,+ save():void+begin():void+clear():void+mainmenu():char+getkey():int+setkey(intk):void-*head:student-key:intStudent#number:int#name20:char#sex6:char#deviceid20:cha

5、r#devicename6:char#devicestatus20:char+student*next。+student() -+student() + * getname():char+getnumber():int+getscore(inti)double+ getg():float+ input():void+input(ifstream & is): void+output():void+output(ofstrea m&os):void2. 界面設(shè)計(jì)1.界面設(shè)計(jì)程序運(yùn)行后會(huì)出現(xiàn)一個(gè)簡捷的窗口,便于用戶查詢數(shù)據(jù)。2功能設(shè)計(jì)通過主窗體調(diào)用其他窗體,具體實(shí)現(xiàn)可以參照系統(tǒng)分析

6、相關(guān)內(nèi)容。應(yīng)用系 統(tǒng)主控界面包括學(xué)生信息錄入,查找等功能模塊。學(xué)生信息錄入功能完成學(xué)生 信息和成績的輸入。記錄查詢功能可以對數(shù)據(jù)各分類的記錄進(jìn)行查詢。3系統(tǒng)主界面:4.調(diào)式分析本程序基本完成了題目要求的功能。但是由于顯示的限制,我未完成統(tǒng)計(jì)的運(yùn)行功 能,老師指導(dǎo)下完成了,要?jiǎng)幽X子。程序在顯示學(xué)生信息時(shí)輸入過于繁雜,不夠清晰明朗,若顯示成類似表格的形式就好了。 解決辦法將輸出函數(shù)的輸出格式改一下,難點(diǎn)是計(jì)算輸出點(diǎn)的控制。此次 C+C+課程設(shè)計(jì),在指導(dǎo)教師的精心教導(dǎo)下,我們學(xué)會(huì)了如何用C+C+編 寫一個(gè)簡單的應(yīng)用程序。首先要對程序的設(shè)計(jì)要求有一個(gè)比較明確的認(rèn)識(shí),然 后系統(tǒng)分析與系統(tǒng)設(shè)計(jì),最后是代碼

7、設(shè)計(jì)與調(diào)試。程序?qū)崿F(xiàn)上,設(shè)計(jì)了簡單的 查詢界面,將各個(gè)功能集中出來按照程序編寫原則,便于查詢。根據(jù) C+C+課程所學(xué)的概念、理論和方法,按照 C+C+程序設(shè)計(jì)的基本步驟, 設(shè)計(jì)出一個(gè)適當(dāng)規(guī)模的程序;進(jìn)一步加深對 C+C+語言的理解和掌握。理論聯(lián)系 實(shí)際,加深和鞏固所學(xué)的理論知識(shí),提高實(shí)踐能力和計(jì)算機(jī)的綜合運(yùn)用能力。 我們編寫程序的過程是辛苦與快樂的,程序的編寫原則很重要,只要我們在編 程,就必須不斷改進(jìn),才能更好提高編程能力。5用戶使用說明按1錄入按2顯示按3查找按4刪除按5統(tǒng)計(jì)等等來操作的學(xué)生上機(jī)管理系統(tǒng)的6.測試結(jié)果7.附錄1.student .h#include#include#incl

8、udeschool.h class studentprotected: int number 。 char name20 。 char devicestatus8。char deviceid10 。 chardevicename20 。public: student *next 。 friend void school:sort() 。 student()student()char* getname()return name 。int getnumber()return number 。void input()int e=1 。 coutttt 按提示輸入 :endl 。 coutnumber

9、 。coutname。 docoutdevicestatus 。if(strcmp(devicestatus,)=0)coutdeviceid 。coutdevicename 。e=0。elsecoutttt 無此類型狀態(tài) ! 重新輸入 !numbernamedevicestatusdeviceiddevicename 。 is.get() 。void output()cout 學(xué)生基本信息如下 :endl 。cout 編 號(hào) :number 姓 名 :name 設(shè) 備 態(tài) :devicestatus設(shè)備編號(hào) :deviceid 設(shè)備名稱 :devicenameendl 。void outpu

10、t(ofstream & os)ossetw(6)number setw(15)namesetw(5)devicestatussetw(5)deviceidsetw(10)devicenamenext=NULL 。key=0 。school:school()開 )=0 | strcmp(devicestatus,delete headvoid school:input()/ 錄入函數(shù)student *p,*p2=NULL 。 p=head。int n 。while(p-next) p=p-next 。while(n) p2=new student 。 p2-input() 。 p-ne

11、xt=p2 。 p2-next=NULL 。 p=p-next 。school:setkey(1) 。coutn 。int school:find(student *p1,int num,char *pn)/ 子查找函數(shù)student *p 。p=head。 while(p-next)(*p1)=p 。 if( (p-next)-getnumber()=num|!strcmp( getname(),pn ) )return 1 。 p=p-next 。return 0 。void school:found()/ 查找函數(shù)student *p 。int num=-1,n=9 。char n am

12、e20=A。do coutn 。(p-next)-while(n2) 。if(n=1)coutnum 。if(n=2)coutname。if(!find(&p,num,name) )coutnext)-output() 。void school:del()/ 刪除函數(shù)student *p,*p2 。int num 。coutnum 。if( !fin d(&p, nu m,“)coutnext)-output() 。p2=p-next 。p-next=p2-next 。delete p2 。school:setkey(1) 。int school:ncount() /統(tǒng)計(jì)函數(shù)s

13、tudent *p 。p=head。int amount=0 。while(p-next)p= p-next 。 amount+。!endl 。!endl 。return amountvoid school:sort() / 排序函數(shù)student *p1 。student *temp=new student 。student *temp1 。student *temp2 。int i,j,count 。int n=ncount() 。 for(j=0 。 in-1 。 j+)p1=head。for(i=0 。inext 。 count- 。if(p1-numberp1-next-number

14、)temp1 = p1-next 。 temp2 = p1-next-next 。memcpy(temp,p1,sizeof(student) 。memcpy(p1,p1-next,sizeof(student) p1-next = temp1 。memcpy(p1-next,temp,sizeof(student) p1-next-next =temp2 。void school:show() / 顯示函數(shù)student *p 。 p=head 。int n=0 。while(p-next)(p-next)-output() p=p-next 。n+。void school:mend()/

15、修改函數(shù)student *p 。 int num=-1,n 。char n ame20=A。docoutn 。while(n2)。if(n=1)coutnum 。if(n=2)coutname。if( !find(&p,num,name) )couttt 找不到你要修改的內(nèi)容 !next)-output() 。(p-next)-input() 。 school:setkey(1) 。void school:save() / 保存函數(shù)student *p 。p=head。ofstream os(student.txt,ios:out)。if (school:getkey()=1)whil

16、e(p-next)(p-next)-output(os) 。 p=p-next 。coutttt 文件已保存 ! num。 is.seekg(t) 。if(numinput(is) 。p-next=p2 。p2-next=NULL 。p=p-next 。void school:clear()/ 清空函數(shù)student *p,*p2 。 p=head-next 。 while( p )p2=p。p=p-nextdelete p2 * * * * * * * * * * * * * * * * * * * * * * * * * * * *endl * * * * * * * * * * * *

17、* * * * * * * * * * * * * * * *endl* *1:錄入學(xué)生信息* *endl* *2:顯示學(xué)生信息* *endl* *3:查找學(xué)生信息* *endl* *4:刪除學(xué)生信息* *endl * *5:統(tǒng)計(jì)學(xué)生數(shù)量* *endl * *6:學(xué)生學(xué)號(hào)排序* *endl* *7:修改學(xué)生信息* *endl* *8:保存學(xué)生信息* *endl* *0:退出系統(tǒng)* *endl* * * * * * * *endl* * * * * * * *endln 。return n0 。2.school.h#include #include class student 。class sc

18、hoolpublic: school() 。 school() 。 void input() 。 void mend() 。 void del() 。int fin d(stude nt *p,i nt nu m,char *pn=) void found() 。int ncount()char school:mainmenu()/char n8 。coutnn主選菜單函數(shù)歡迎進(jìn)入學(xué)生上機(jī)管理系統(tǒng)endlendlvoid sort() 。void show() 。void save() 。void begin() 。void clear() 。char mainmenu() 。int getk

19、ey() return key。 void setkey(int k) key=k。 private:student *head 。int key 。3.main.cpp#includestudent.h void main()/ 主函數(shù)school pp 。int k=1 。char n 。pp.begin() 。while(k=1)n=pp.mainmenu() 。switch(n)case 1:pp.input()。 break 。case 2 pp.show()。 break 。case 3 pp.found()。 break 。case 4 pp.del()。 break 。case

20、 5 pp.ncount()。 break 。case 6 pp.sort()。 break 。case 7 pp.mend()。 break 。case 8 pp.save()。 break 。case 0if(pp.getkey()=1)coutk 。if(k=1)pp.save() 。pp.clear() 。k=0。break 。版權(quán)申明本文部分內(nèi)容,包括文字、圖片、以及設(shè)計(jì)等在網(wǎng)上搜集整 理。版權(quán)為潘宏亮個(gè)人所有This article in eludes some parts, in cludi ng text, pictures, anddesig n. Copyright is

21、Pan Hon glia ngs pers onal own ership.用戶可將本文的內(nèi)容或服務(wù)用于個(gè)人學(xué)習(xí)、研究或欣賞,以及其他非商業(yè)性或非盈利性用途,但同時(shí)應(yīng)遵守著作權(quán)法及其他相關(guān)法律的規(guī)定, 不得侵犯本網(wǎng)站及相關(guān)權(quán)利人的合法權(quán)利。 除此以 外,將本文任何內(nèi)容或服務(wù)用于其他用途時(shí),須征得本人及相關(guān)權(quán) 利人的書面許可,并支付報(bào)酬。Users may use the contents or services of this article forpers onal study, research or appreciati on, and othernon-commercial or non-profit purposes, but at the same time, theyshall abide by the provisio

溫馨提示

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

評(píng)論

0/150

提交評(píng)論