




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、精選優質文檔-傾情為你奉上信息科學與技術學院程序設計基礎課程設計報告題目名稱: 學生考勤管理系統 學生姓名: 郭晨晨 學 號: 專業班級: 13級計科(3)班指導教師: 郭理 2013年6月6日目錄 1. 課程設計題目與要求1.1 課題目的和要求設計目的:要求實現-“學生考勤管理程序”記錄學生的缺課情況,它包括:缺課日期、第幾節課、課程名稱、學生姓名、缺課類型(遲到、早退、請假及曠課)。1.2 設計要求: 1.錄入學生的缺課記錄;2修改某個學生的缺課記錄;3查詢某個學生的缺課情況;4統計某段時間內,某門課曠課學生姓名及曠課次數,按曠課次數由多到少排序; 5統計某段時間內,有學生曠課的課程及曠課
2、人次,按曠課人次由多到少排序;6.系統以菜單方式工作。1.3 課題意義程序實踐是本科生重要教學環節之一。通過程序實踐,強化學生的計算機應用技能,使學生驗證、鞏固和充實所學的理論知識, 加深對相關內容的理解,拓寬知識面,培養學生的創新精神和實踐能力學生考勤管理程序可以大大減緩學生考勤人員的工作量, 方便了平時上課學生的出勤率的管理。 2 總體設計2.1功能模塊設計根據分析整個系統主要劃分為7個功能模塊,分別執行要求中的功能。數據管理中可以對學生的基本信息、課程的基本信息、學生缺課的查詢、添加、刪除和修改。查詢管理通過根據學生姓名,課程姓名 時間段兒等信息,查詢單個學生的缺課記錄,單科課的曠課記錄
3、,單個學生的曠課記錄。功能模塊圖如圖1所示:圖1功能模塊圖2.2系統設計方案這個程序是過程性語言設計的。運用多種條件語句,主體采用的是鏈表指針。系統的設計采用了數組語句、選擇語句和循環語句,在需要處理大量同類數據時,這樣就使程序書寫更加簡潔。程序使用了布爾函數。選擇語句多采用if多分支選擇結構與switch語句。首先計算switch表達式,然后在caes子句中尋找值相等的常量表達式,并以此為入口符號,由此開始順序執行。循環語句采用了for語句等、do-while語句,for語句用于已知循環次數的循環結構,括號中的三個量分別用來表示循環變量初值、循環終值和循環增量。do-while語句先循環后判
4、斷, Break語句在switch語句中,保證多分支情況的正確執行,在循環語句中,強制終止本層循環。保存和讀取函數是典型的函數功能,一個程序是由若干個函數組成的,保存和讀取函數是和其他函數互相調用的。 3 詳細設計3.1 數據結構設計 struct xuekechar xueke_name50;int people_num;這是定義了一個xueke結構體,用來存放一個學科名及其相應的曠課人數;struct studentchar name50;long time;int lesson_time;char lesson_name50;int chidao_num;int zaotui_num;i
5、nt qingjia_num;int kuangke_num;struct student *next;這是定義了一個student的結構體,用來存放一個學生的考勤記錄,其中有,字符數組name50,lesson_name50,分別存放學生名字,缺課課程名字;int型變量lesson_time,chidao_num,zaotui_num,qingjia_num, kuangke_num,分別來存放,缺課節次,遲到次數,早退次數,請假次數,曠課次數 long型變量time,記錄時間。 3.2 主模塊設計3.2.1建立學生缺課記錄子模塊要建立的學生人數,學生基本信息(包括缺課時間、學生姓名、課程名
6、稱、節次、遲到次數、早退次數、請假次數、曠課次數)可用creat()函數如圖1. 圖13.2.2修改學生缺課記錄子模塊根據要修改的學生姓名以及科目名稱找到相應的信息,再選擇要修改的項目進行單項修改 如圖2 圖23.2.3修改學生缺課記錄子模塊根據人名可以查出該學生的所有缺課記錄 如圖3 圖33.2.4查看單科曠課記錄子模塊根據學科名稱和時間范圍查出所有在該范圍內曠課的學生以及次數 如圖4 圖43.2.5查看學生曠課記錄子模塊根據要查詢的學科名稱及時間段查出在改時間段內該門課上曠課的人數 如圖5 圖53.2.6載入學生曠課記錄子模塊可以載入實現儲存在當前文件夾中txt文件中所儲存的數據 如圖6
7、圖63.2.7儲存學生曠課記錄子模快進入系統界面,順序的完成各項操作,進行數據的輸入,信息的保存調用相應的函數打開相應的地址,查詢各項信息。如圖7 圖7 4. 運行結果4.1運行開始菜單圖1 開始菜單主菜單 圖2 主菜單建立學生缺課記錄圖2建立學生缺課記錄儲存學生曠課記錄圖3儲存學生曠課記錄 5. 課程設計總結課程設計順利完成,題目所要求的功能基本實現,可以對學生的缺課信息進行添加,修改,刪除以及查詢的顯示。不過這個程序還不夠完善,例如不能往當前文件夾中的txt文件中添加記錄。結束語整個系統的設計過程對于我來說是個學習、探索的過程,通過借鑒別人,學習設計程序,在整個設計過程中,出現過很多的問題
8、,很多繁瑣的東西都需要反復的修改,主要是因為前期的學習不認真,對系統的需求分析的要求認識不清楚,使得在后邊的工作中不得不經常反復請教別人去修改。使我體會到設置中每一步的重要性。所以在分析一個問題時,我們需要站在一個有遠見的高度。通過此次設計,我對C+語言編程有了深刻的認識,積累了使用軟件工程的思想來開發軟件的經驗,更重要的是學會了在對待問題時應該考慮到哪些方面和怎么解決問題。雖然時間緊迫但我學會了不少,感到自身知識的貧乏,希望在日后積極學習并嘗試努力中能做出完善的系統。參考文獻1譚浩強.C+語言程序設計.清華大學出版社2求是科技.Visual C+ 6.0信息系統開發.人民郵電出版社附錄:源代
9、碼 #include<cstdio> /cstdio是將stdio.h的內容用C+頭文件的形式表示出來#include<iostream> #include<malloc.h> /malloc的全稱是memory allocation,中文叫分配,當無法知道內存具體位置的時候,想要綁定真正的內存空間,就需要用到動態的分配內存。#include<cstring> /當調用庫函數,客戶程序提供的是string類型參數,而庫函數內部實現用的是c-串,因此需要將string對象,轉化為char*對象,而c_str()提供了這樣一種方法,它返回一個客戶程序
10、可讀不可改的指向字符數組的指針。#include<iomanip> /I/O流控制頭文件#define NULL 0#define guding 10#define LEN sizeof(struct student)using namespace std;int student_num;FILE *fp1;struct xuekechar xueke_name50;int people_num;struct studentchar name50;long time;int lesson_time;char lesson_name50;int chidao_num;int zaot
11、ui_num;int qingjia_num;int kuangke_num;struct student *next;void chaxun(struct student *head)int i;char chaxun_name50;cout<<"請輸入要查詢的人名:" cin>>chaxun_name;struct student *p;if(head=NULL)cout<<"聯系人為空"p=head;for(i=0;i<student_num;i+)if(strcmp(chaxun_name,p->n
12、ame)=0)cout<<"缺課時間:"<<p->time<<" 學生姓名:"<<p->name<<" 課程名稱:"<<p->lesson_name<<" 節次:"<<p->lesson_time<<endl <<"遲到次數:"<<p->chidao_num<<" 早退次數:"<<p->
13、zaotui_num<<" 請假次數:"<<p->qingjia_num<<" 曠課次數:"<<p->kuangke_num<<endl;p=p->next; struct student *xiugai(struct student *head)char xiugai_name50;char xiugai_xueke_name50;int k;cout<<"請輸入要修改的學生姓名與學科名稱【格式:學生姓名(空格)學科名稱】:"cin>&g
14、t;xiugai_name>>xiugai_xueke_name;struct student *p1,*p2; p2=(struct student *)malloc(LEN);p1=head;if(head=NULL)cout<<"沒有學生信息n"return head; while(strcmp(xiugai_name,p1->name)!=0|strcmp(xiugai_xueke_name,p1->lesson_name)!=0)&&(p1->next!=NULL)p1=p1->next; if(st
15、rcmp(xiugai_name,p1->name)=0&&strcmp(xiugai_xueke_name,p1->lesson_name)=0) cout<<"= 修改信息 =n" cout<<" 1-修改缺課時間 n"cout<<" 2-修改學生姓名 n"cout<<" 3-修改課程名稱 n"cout<<" 4-修改第幾節缺課 n"cout<<" 5-修改遲到次數 n"c
16、out<<" 6-修改早退次數 n"cout<<" 7-修改請假次數 n"cout<<" 8-修改曠課次數 nn"cout<<"=n"cin>>k;switch(k)case 1:cout<<"請輸入新的缺課時間:"cin>>p1->time;break;case 2:cout<<"請輸入新的學生姓名:"cin>>p1->name;break;case 3:
17、cout<<"請輸入新的課程名稱:"cin>>p1->lesson_name;break;case 4:cout<<"請輸入新的缺課節次:"cin>>p1->lesson_time;break;case 5:cout<<"請輸入新的遲到次數:"cin>>p1->chidao_num;break;case 6:cout<<"請輸入新的早退次數:"cin>>p1->zaotui_num;break;c
18、ase 7:cout<<"請輸入新的請假次數:"cin>>p1->qingjia_num;break;case 8:cout<<"請輸入新的曠課次數:"cin>>p1->kuangke_num;break; return head;struct student *creat()int i,b;struct student *head,*p1,*p2; cout<<"請輸入要建立資料的學生人數:"cin>>b;head=p2=NULL;p1=(struc
19、t student *)malloc(LEN);cout<<"【輸入格式:缺課時間(空格)學生姓名(空格)課程名稱(空格)第幾節(空格)遲到次數(空格)早退次數(空格)請假次數(空格)曠課次數】n"cout<<"請輸入第1名學生信息:" cin>>p1->time>>p1->name>>p1->lesson_name>>p1->lesson_time>>p1->chidao_num>>p1->zaotui_num>&g
20、t;p1->qingjia_num>>p1->kuangke_num;head=p1;p2=p1;student_num+=1;for(i=1;i<b;i+)p1=(struct student*)malloc(LEN);cout<<"請輸入第"<<i+1<<"名學生信息:" cin>>p1->time>>p1->name>>p1->lesson_name>>p1->lesson_time>>p1->
21、chidao_num>>p1->zaotui_num>>p1->qingjia_num>>p1->kuangke_num;p2->next=p1;p2=p1;student_num+=1; p2->next=NULL; return head;void print(struct student *head)struct student *p;p=head;if(p=NULL)cout<<"沒有學生信息n"while(p!=NULL) cout<<"缺課時間:"<
22、;<p->time<<" 學生姓名:"<<setw(10)<<p->name<<" 課程名稱:"<<p->lesson_name<<" 節次:"<<p->lesson_time<<endl <<"遲到次數:"<<p->chidao_num<<" 早退次數:"<<p->zaotui_num<<"
23、; 請假次數:"<<p->qingjia_num<<" 曠課次數:"<<p->kuangke_num<<endl;p=p->next;struct student *tongji_lesson(struct student *head)struct student *p1,*p2,*p3;char lesson50;long look_time1,look_time2;int xunhuan_num=0;p3=(struct student *)malloc(LEN);if(head=NULL)co
24、ut<<"沒有學生信息"return(head); p1=head;p2=p1->next;while(xunhuan_num<student_num)while(p2!=NULL)if(p2->kuangke_num>p1->kuangke_num)p3->chidao_num=p2->chidao_num;p3->kuangke_num=p2->kuangke_num;p3->qingjia_num=p2->qingjia_num;p3->zaotui_num=p2->zaotui
25、_num;p3->lesson_time=p2->lesson_time;p3->time=p2->time;strcpy(p3->lesson_name,p2->lesson_name);strcpy(p3->name,p2->name);p2->chidao_num=p1->chidao_num;p2->kuangke_num=p1->kuangke_num;p2->qingjia_num=p1->qingjia_num;p2->zaotui_num=p1->zaotui_num;p2->
26、lesson_time=p1->lesson_time;p2->time=p1->time;strcpy(p2->lesson_name,p1->lesson_name);strcpy(p2->name,p1->name);p1->chidao_num=p3->chidao_num;p1->kuangke_num=p3->kuangke_num;p1->qingjia_num=p3->qingjia_num;p1->zaotui_num=p3->zaotui_num; p1->lesson_time
27、=p3->lesson_time;p1->time=p3->time;strcpy(p1->lesson_name,p3->lesson_name);strcpy(p1->name,p3->name);p1=p2;p2=p2->next;p1=head;p2=p1->next;xunhuan_num+;cout<<"請輸入要查看的學科名稱:"cin>>lesson;cout<<"請輸入要查看的時間范圍【輸入格式:時間(空格)時間】"cin>>look_t
28、ime1>>look_time2;p1=head; while(p1!=NULL)if(strcmp(lesson,p1->lesson_name)=0&&look_time1<=p1->time&&p1->time<=look_time2)cout<<"學生姓名:"<<p1->name<<" 曠課次數:"<<p1->kuangke_num<<endl;p1=p1->next; return head;s
29、truct student *tongji_student(struct student *head) struct xueke a10;int n,i,j,zhongjian;struct student *p1;char zhongjian_name50;long look_time1,look_time2;if(head=NULL)cout<<"沒有學生信息n"return head; cout<<"請輸入一共的學科數:"cin>>n;for(i=0;i<n;i+)cout<<"請輸入
30、第"<<i+1<<"個學科名稱:"cin>>ai.xueke_name;ai.people_num=0; cout<<"請輸入要查看的時間范圍由小到大【輸入格式:時間(空格)時間】"cin>>look_time1>>look_time2;p1=head;for(i=0;i<n;i+)while(p1!=NULL&&look_time1<=p1->time&&p1->time<=look_time2)if(ai.x
31、ueke_name=p1->lesson_name)ai.people_num+=p1->kuangke_num; p1=p1->next;p1=head; for(j=0;j<n-1;j+) for(i=0;i<n-1-j;i+)if(ai.people_num<ai+1.people_num)zhongjian=ai+1.people_num;ai+1.people_num=ai.people_num;ai.people_num=zhongjian;strcpy(zhongjian_name,ai+1.xueke_name);strcpy(ai+1.xu
32、eke_name,ai.xueke_name);strcpy(ai.xueke_name,zhongjian_name);else if(ai.people_num=ai+1.people_num&&strcmp(ai.xueke_name,ai+1.xueke_name)>0) zhongjian=ai+1.people_num;ai+1.people_num=ai.people_num;ai.people_num=zhongjian;strcpy(zhongjian_name,ai+1.xueke_name);strcpy(ai+1.xueke_name,ai.xue
33、ke_name);strcpy(ai.xueke_name,zhongjian_name);for(i=0;i<n;i+)cout<<"學科名稱:"<<ai.xueke_name<<" 曠課次數:"<<ai.people_num<<endl;return head;return head;struct student *zairu()struct student *p1=NULL,*p2=NULL,*head=NULL;struct student student_ziliao100;in
34、t i=0,n=0;if(fp1=fopen("xueshengziliao.txt","rb+")=NULL) printf("cannot open filen");return(head); while(!feof(fp1)if(fread(&student_ziliaoi,LEN,1,fp1)!=1)if(feof(fp1)fclose(fp1); break; printf("file read errorn");i+;n=i;student_num=n;p1=p2=(struct student
35、 *)malloc(LEN);head=p1;for(i=0;i<n;i+)p1->chidao_num=student_ziliaoi.chidao_num;p1->kuangke_num=student_ziliaoi.kuangke_num;strcpy(p1->lesson_name,student_ziliaoi.lesson_name);p1->lesson_time=student_ziliaoi.lesson_time;strcpy(p1->name,student_);p1->qingjia_num=student_ziliaoi.qingjia_num;p1->time=student_ziliaoi.time;p1->zaotui_num=student_ziliaoi.zaotui_num;p2->next=p1;p2=p1;p1=(struct student*)malloc(LEN); p2->next=NULL;re
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 古典園林考試題及答案
- 托育師考試試題及答案
- 認識幾時幾分課件
- 艾滋病與肺結核防治宣傳教育
- 辦公軟件提升培訓
- 職業技能培訓實施細則
- 醫院護理設備管理
- 防冰凌安全教育
- 銀行信用風險培訓
- 2025年中國尿素模塑馬桶座圈行業市場全景分析及前景機遇研判報告
- 酒店用火用電安全管理制度
- 模具機加工管理制度
- 區畜牧局十五五總結及十五五規劃
- 2025年普通高等學校招生全國統一考試(全國I卷英語)及答案
- 銀行支行安全防范教育培訓制度
- 艾梅乙考試試題及答案
- T/CECS 10363-2024薄壁不銹鋼管件用法蘭及法蘭接頭
- DB31/T 1096-2018醫院日間手術管理規范
- 2025年MySQL數據庫編程試題及答案
- C++冒泡排序實現試題及答案
- DB32-T 5119-2025 鋰離子電池工廠生產安全技術規范
評論
0/150
提交評論