數(shù)據(jù)結(jié)構(gòu)課程設(shè)計-員工信息管理系統(tǒng)_第1頁
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計-員工信息管理系統(tǒng)_第2頁
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計-員工信息管理系統(tǒng)_第3頁
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計-員工信息管理系統(tǒng)_第4頁
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計-員工信息管理系統(tǒng)_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、成績12信計 2013-2014 (一)數(shù)據(jù)結(jié)構(gòu)課程設(shè)計設(shè)計題目員工信息管理系統(tǒng)設(shè)計時間2014.1.62014.1.10學(xué)生姓名葛考學(xué)生學(xué)號20120402127所在班級12精算指導(dǎo)教師 劉風(fēng)華徐州工程學(xué)院數(shù)學(xué)與物理科學(xué)學(xué)院題目 員工信息管理系統(tǒng)一、需求分析員工信息管理系統(tǒng)設(shè)計,具體功能如下:1、系統(tǒng)以菜單方式工作,應(yīng)為用戶提供清晰的使用提示,依據(jù)用戶的選擇來進行各種處理,并 且在此過程中能夠盡可能的兼容用戶使用過程中的輸入異常情況。2、員工信息錄入系統(tǒng)(員工信息用文件保存),注意員工按員工編號進行區(qū)分,即每個員工的 員工編號都是唯一的,不允許出現(xiàn)兩個員工或員工編號相同的情況。3、可對員工信

2、息進行查詢,具體分為:按姓名查詢、按員工號查詢、按生日查詢;4、可對員工信息進行刪除;5、可對員工信息進行修改,但應(yīng)注意員工號不能修改,修改應(yīng)逐個進行,一個員工記錄的更改 不應(yīng)影響其他的員工記錄;6可對全部的員工信息進行顯示 v(員工信息瀏覽),注意員工信息的顯示規(guī)范; 員工信息應(yīng)包括姓名、員工編號、性別、年齡、生日、學(xué)歷、職務(wù)、聯(lián)系電話、住址。二、概要設(shè)計2.1 、抽象數(shù)據(jù)類型ADT List數(shù)據(jù)對象:D=ai|ai ElemSet, i=1 , 2,n,n>=0數(shù)據(jù)關(guān)系:R1=<ai-1 , ai>|ai-1 , ai D, i=1 , 2,n基本操作: Init Lis

3、t(&L) ; 操作結(jié)果:構(gòu)造一個空的線性表 L。DestroyList(&L);初始條件:線性表 L 存在。 操作結(jié)果:銷毀線性表 L 。LocateElem(L,I,&e);初始條件:線性表 L 存在, 1<i<Listlength(L) 。操作結(jié)果:用e返回線性表L中第i個數(shù)據(jù)元素的值。ClearList( &L); 初始條件:線性表 L 存在。操作結(jié)果:將線性表 L 重置為空表。ADT Graph2.2 、程序流程系統(tǒng)的執(zhí)行從菜單的選擇開始,依據(jù)用戶的選擇進行相應(yīng)的處理,直到用戶選擇退出系統(tǒng) 為止。其間應(yīng)對用戶的選擇做出判斷及異常處理。系統(tǒng)的

4、流程如圖 1 所示:圖 1 員工信息管理系統(tǒng)流程圖三、詳細(xì)設(shè)計3.1 函數(shù)構(gòu)成(1)主函數(shù): void main(); ( 2)文件讀入函數(shù): void read data();( 3)文件寫入函數(shù): void write data();( 4 )菜單函數(shù)函數(shù)原型: void Menu() 功能:此函數(shù)的功能為依據(jù)用戶選擇的功能來進行相應(yīng)的處理,直到用戶選擇退出系統(tǒng)為 止,包括員工信息的查詢、更新、列表及退出管理;(5)信息查詢函數(shù) 函數(shù)原型: void chaxun() 功能:該函數(shù)的功能是按照用戶的選擇進行不同方式的查找,本程序?qū)崿F(xiàn)了按三種方式進 行查找,包括按編號、姓名、生日查找;(6)

5、信息更新函數(shù) 函數(shù)原型: void gengxin() 功能:此函數(shù)的功能為使用戶修改記錄。首先判斷用戶要修改的記錄是否存在,因為只有 員工編號是唯一的,所以根據(jù)員工編號進行查找。若存在則用用戶輸入的新的信息替換原信息; 若不存在則函數(shù)結(jié)束。在此函數(shù)中要注意的是文件的打開方式應(yīng)為” rb+,因為在這個函數(shù)中不僅要讀文件,還要向文件中寫入數(shù)據(jù),所以要用讀寫的方式打開二進制文件;(7)信息一覽函數(shù) 函數(shù)原型: void liebiao() 功能:此函數(shù)的功能為從文件中依次取出每條記錄并將其顯示出來。因為只需讀文件不需要向文件中寫入數(shù)據(jù),所以文件的打開方式是只讀。3.2 模塊程序清單 (詳細(xì)程序見附

6、錄)1、員工信息的結(jié)構(gòu)體:Typedef struct emplong int num;/ 編號char name20;/姓名int age;/年齡char sex4;/性別char birthday10;/生日char tel15;/電話char edu8;/學(xué)歷char pos20;/職務(wù)char add30;/住址struct emp *next;2、菜單函數(shù):void menu(void) char i,lj100; int flog;time_t T; struct tm * timenow;time ( &T );timenow = localtime ( &T )

7、; flog=0;while(1)system("cls"); printf("nnnnn");printf(" |員工信息管理系統(tǒng)1n");printf(" | n");printf(" | n");printf(" | n");printf(" |1.員工信息查詢| n");printf(" | n");printf(" | n");printf(" | n");printf(" |

8、2.員工信息更新| n");printf("|n");printf("|n");printf("|n");printf(" |3.員工信息列表| n");printf("|n");printf("|n");printf("|n");printf(" |0.退出管理系統(tǒng)| n");printf("|n");printf("|n");printf("|n");printf

9、(" 11n");printf(" %s", asctime (timenow) ); printf("請輸入您的選擇(數(shù)字0-3): n"); scanf("%c",&i);gets(lj); if(lj0)i='a'switch(i) case '1':chaxun();break;case '2':gengxin();break;case '3':liebiao();break;case '0':flog=1;break;

10、 default:printf(" 輸入有誤,請按回車鍵重新輸入 n");gets(lj);break; if(flog)break;3、信息查詢函數(shù):void chaxun()char i,lj100; int flog; time_t T; struct tm * timenow; time ( &T );timenow = localtime ( &T ); flog=0;while(1)system("cls"); printf("nnnnn");printf(“ |員工信息查詢系統(tǒng)1n");prin

11、tf("| n");printf("| n");printf("| n");printf("|1.按照編號查詢| n");printf("| n");printf("| n");printf("| n");printf("|2.按照姓名查詢| n");printf("| n");printf("| n");printf("| n");printf("|3.按照生日查詢

12、| n");printf("| n");printf("| n");printf("|0.退出管理系統(tǒng)| n");printf("| n");printf("| n");printf("| n");printf(” 11n");printf("%s", asctime (timenow) );printf("請輸入您的選擇(數(shù)字0-3): n");scanf("%c",&i);gets(l

13、j); if(lj0)i='a'switch(i)case '1':bianhao();break; case '2':xingming();break;case '3':shengri();break; case '0':flog=1;break; default:printf(" 輸入有誤,請重新輸入 n");gets(lj);break;if(flog)break;4、信息更新函數(shù):void gengxin()char i,lj100;time_t T;int flog;struct tm

14、 * timenow;time ( &T );timenow = localtime ( &T );flog=0;while(1)system("cls");printf("nnnnn");printf(“ i員工信息更新系統(tǒng)1n");printf(" | n");printf(" | n");printf("| n");printf("|1.員工信息添加| n");printf("| n");printf("| n&q

15、uot;);printf("| n");printf("|2.員工信息刪除| n");printf("| n");printf("| n");printf("| n");printf("|3.員工信息修改| n");printf("| n");printf("| n");printf("| n");printf("|0.退出管理系統(tǒng)| n");printf("| n");pri

16、ntf("| n");printf("| n");printf(” 11n");printf(" %s",asctime (timenow) );printf(" 請輸入您的選擇(數(shù)字 0-3): n");scanf("%c",&i);gets(lj);if(lj0)i='a'switch(i) case '1':tianjia();break;case '2':shanchu();break;case '3':x

17、iugai();break;case '0':flog=1;break;default:printf(" 輸入有誤,請重新輸入 n");gets(lj);break; if(flog)break;5、信息一覽函數(shù):void liebiao()char lj100; struct emp *p; p=head; system("cls"); if(head=NULL)printf("查找不到信息 n");menu(); printf("員工信息列表 n");printf("編號tt姓名tt年

18、齡tt性別tt出生年月tt電話tt學(xué)歷tt職務(wù)tt住址:n"); if(head!=NULL)while(p!=NULL)display(p);p=p->n ext;printf("n按回車鍵返回主菜單n");gets(lj);四、調(diào)試分析4.1、時間復(fù)雜度分析在源程序的各個模塊,時間復(fù)雜讀為|兇并且隨著輸入信息量的增加,從而時間復(fù)雜度 也逐漸增加。4.2、問題解決在程序設(shè)計過程中,本程序采用兩種方式進行數(shù)據(jù)輸入,一種是由用戶手動輸入數(shù)據(jù),另 一種是由文本文件數(shù)據(jù)導(dǎo)入 的方式。但在文本導(dǎo)入過程中,導(dǎo)入的是二進制文件,但由于復(fù) 雜程度較高,從而根據(jù)所查資料進行

19、修改,采用導(dǎo)入文本文件。在結(jié)果輸出上,由于輸出的是黑屏,所以經(jīng)過查閱資料,運用| DO |函數(shù)對輸出結(jié)果的頁面進行修飾。4.3、設(shè)計收獲在做實驗前,一定要將課本上的知識吃透,因為這是做實驗的基礎(chǔ),否則,在做設(shè)計程序 實驗時,這將使你做的難度加大,浪費寶貴的時間,使你事倍功半。做實驗時,一定要親力親 為,務(wù)必要將每個步驟,每個細(xì)節(jié)弄清楚,弄明白。實驗后,還要復(fù)習(xí),思考,這樣,你的印 象才深刻,記得才牢固,否則,過后不久你就會忘得一干二凈,這還不如不做。通過這次程序 設(shè)計的實驗,使我們學(xué)到了不少實用的知識,更重要的是,做實驗的過程,思考問題的方法, 這與做其他的實驗是通用的,真正使我們們受益匪淺。

20、五、測試結(jié)果1、菜單函數(shù)的測試結(jié)果如圖2圖22、信息查詢函數(shù)的測試結(jié)果如圖 3圖33、信息更新函數(shù)測試結(jié)果如圖 4圖4六、用戶使用說明本程序?qū)嵲赩B.6.0環(huán)境下通過編譯并執(zhí)行。用戶根據(jù)提示信息進行選擇并操作。七、附錄源程序:#include <stdio.h>#include <malloc.h>#include <stdlib.h>#include <windows.h>/ 清屏函數(shù)頭文件#include <string.h>#include <time.h>#include <io.h>#define L

21、EN sizeof(struct emp)#define DATA "employee.txt"struct emplong int num;/編號char name20;/姓名int age;/年齡char sex4;/性別char birthday10;/生日 char tel15; / 電話 char edu8; /學(xué)歷 char pos20; /職務(wù) char add30; / 住址 struct emp *next;struct emp *head=NULL; int t=0;void menu();void gengxin();void tianjia(); v

22、oid insert(struct emp *em); void display(struct emp *p);void liebiao();void chaxun();void bianhao();void shengri();void xingming();void readDate();void writeDate(); void freeAll();void shanchu();void change();void devise(struct emp *p); void main()struct emp *head=NULL;head=(struct emp *)malloc(LEN)

23、; head->next=NULL;system("color F1"); system("mode con: cols=500 lines=1000"); readDate();menu(); system("cls"); printf("nnnnnnnnnnnnnnnnnnn");printf(" 謝謝使用,再見 n"); void menu(void)char i,lj100; int flog;time_t T;struct tm * timenow;time ( &T )

24、;timenow = localtime ( &T );flog=0;while(1)system("cls"); printf("nnnnn");printf("1員工信息管理系統(tǒng)1n");printf("11 n");printf("11 n");printf("11 n");printf("11員工信息查詢1 n");printf("11 n");printf("11 n");printf("

25、11 n");printf("丨2員工信息更新1 n");printf("11 n");printf("11 n");printf("11 n");printf("13員工信息列表1 n");printf("11 n");printf("11 n");printf("11 n");printf("10.退出管理系統(tǒng)1 n");printf("11 n");printf("11

26、n");printf("11 n");11n"printf("n );printf("%s", asctime (timenow) );printf(" 請輸入您的選擇(數(shù)字 0-3): n");scanf("%c",&i);gets(lj); if(lj0)i='a'switch(i)case '1':chaxun();break;case '2':gengxin();break;case '3':liebiao

27、();break;case '0':flog=1;break;default:printf(" 輸入有誤,請按回車鍵重新輸入 n");gets(lj);break;if(flog)break; void tianjia()struct emp *p,*p1; char lj100;p=NULL;p1=head;printf("請輸入第%d個員工的信息.n",t+1);p=(struct emp *)malloc(LEN); if(p=NULL)printf(" 分配空間失敗 "); exit(0);printf(&qu

28、ot; 請輸入員工的編號 :n"); scanf("%ld",&p->num);while(p1!=NULL)&&(p->num!=p1->num)p1=p1->next;if(p1!=NULL)if(p->num=p1->num)printf("編號已經(jīng)存在,請重新輸入,按回車鍵繼續(xù):n");scanf("%s",p->name);scanf("%d",&p->age); scanf("%s",p->

29、;sex);free(p);gets(lj);getchar(); printf("請輸入員工的姓名:n"); printf("請輸入員工的年齡:n"); printf("請輸入員工的性別:n");printf(" 請輸入員工的出生年月 :n"); scanf("%s",p->birthday);scanf("%s",p->tel);scanf("%s",p->edu); scanf("%s",p->pos);

30、scanf("%s",p->add);printf(" 請輸入員工的電話 :n"); printf("請輸入員工的學(xué)歷:n"); printf("請輸入員工的職務(wù):n"); printf("請輸入員工的住址:n");insert(p); printf(" 輸入的員工信息為 :n");printf(":n");printf("編號tt姓名tt年齡tt性別tt出生年月tt電話tt學(xué)歷tt職務(wù)tt住址:n"); display(p);p

31、rintf(" 按回車鍵繼續(xù) n");writeDate(); gets(lj);getchar();void insert(struct emp *em)struct emp *p0,*p1,*p2; p1=head; p0=em;if(head=NULL)head=p0;p0->next=NULL;else while(p0->num > p1->num)&&(p1->next!=NULL) p2=p1; p1=p1->next; if(p0->num<=p1->num) if(head=p1)hea

32、d=p0; else p2->next=p0;p0->next=p1; else p1->next=p0; p0->next=NULL; t+; void display(struct emp *p) printf("%ldtt%stt%dtt%stt%stt%stt%stt%stt%sn",p->num,p->name,p->age,p->sex,p- >birthday,p->tel,p->edu,p->pos,p->add); void liebiao() char lj100; struc

33、t emp *p; p=head; system("cls"); if(head=NULL)printf(" 查找不到信息 n");menu();printf("員工信息列表 n");printf("編號tt姓名tt年齡tt性別tt出生年月tt電話tt學(xué)歷tt職務(wù)tt住址:n"); if(head!=NULL)while(p!=NULL) display(p);p=p->next; printf("n 按回車鍵返回主菜單 n");gets(lj); void chaxun()char i,

34、lj100;int flog;time_t T;printf(“ |員工信息查詢系統(tǒng)1n");printf(" | n");printf(" | n");printf("| n");printf("|1.按照編號查詢| n");printf("| n");printf("| n");printf("| n");printf("|2.按照姓名查詢| n");printf("| n");printf("

35、;| n");printf("| n");printf("|3.按照生日查詢| n");printf("| n");printf("| n");printf("|0.退出管理系統(tǒng)| n");printf("| n");printf("| n");printf("| n");printf(” 11n");system("cls"); printf("nnnnn");struct

36、tm * timenow;time ( &T );timenow = localtime ( &T ); flog=0;while(1)printf("%s", asctime (timenow) );printf(" 請輸入您的選擇(數(shù)字 0-3): n"); scanf("%c",&i);gets(lj); if(lj0)i='a'switch(i)case '1':bianhao();break; case '2':xingming();break;case '3':shengri();break; case '0':flog=1;break; default:printf(" 輸入有誤,請重新輸入 n");gets(lj);break;if(flog)break;void bianhao()int number;char lj100;struct emp *p1;p1=head;printf("

溫馨提示

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

評論

0/150

提交評論