c語言程序設(shè)計教師工資管理系統(tǒng)具體的設(shè)計報告_第1頁
c語言程序設(shè)計教師工資管理系統(tǒng)具體的設(shè)計報告_第2頁
c語言程序設(shè)計教師工資管理系統(tǒng)具體的設(shè)計報告_第3頁
c語言程序設(shè)計教師工資管理系統(tǒng)具體的設(shè)計報告_第4頁
c語言程序設(shè)計教師工資管理系統(tǒng)具體的設(shè)計報告_第5頁
已閱讀5頁,還剩17頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、課程設(shè)計報告學(xué)院:天津理工大學(xué)華信軟件學(xué)院專業(yè)名稱:軟件工程課程設(shè)計科目C語言課程設(shè)計所在班級:一班學(xué)生學(xué)號:學(xué)生姓名:吳健指導(dǎo)教師:陳立娜完成時間:2011年4月-6月教師工資管理系統(tǒng)每個教師的信息為:教師號、姓名、性別、單位名稱、家庭住址、聯(lián)系電話、基本工資、津貼、生活補貼、應(yīng)發(fā)工資、電話費、水電費、房租、所得稅、衛(wèi)生費、公積金、合計扣款、實發(fā)工資。注:應(yīng)發(fā)工資=基本工資+津貼+生活補貼;合計扣款=電話費+水電費+房租+所得稅+衛(wèi)生費+公積金;實發(fā)工資=應(yīng)發(fā)工資合計扣款。A、教師信息處理(1)輸入教師信息(2) 插入(修改)教師信息:(3) 刪除教師信息:(4) 瀏覽教師信息:提示:具體功

2、能及操作參考題1。B、教師數(shù)據(jù)處理:(1) 按教師號錄入教師基本工資、津貼、生活補貼、電話費、水電費、房租、所得稅、衛(wèi)生費、公積金等基本數(shù)據(jù)。(2) 教師實發(fā)工資、應(yīng)發(fā)工資、合計扣款計算。提示:計算規(guī)則如題目。(3) 教師數(shù)據(jù)管理提示:輸入教師號,讀出并顯示該教師信息,輸入新數(shù)據(jù),將改后信息寫入文件(4) 教師數(shù)據(jù)查詢:提示:輸入教師號或其他信息,即讀出所有數(shù)據(jù)信息,并顯示出來。(5) 教師綜合信息輸出提示:輸出教師信息到屏幕。1. 課程設(shè)計目的和要求A 鞏固和加強c語言程序設(shè)計課程的理論知識。B 掌握c語言的基本概念,語法,語義和數(shù)據(jù)類型的使用特點。C 掌握c語言程序設(shè)計的方法及編程技巧,能

3、正確使用c語言編寫程序。D 進一步理解和運用結(jié)構(gòu)化程序設(shè)計的思想和放法。E 使學(xué)生掌握調(diào)試程序的基本方法及上機操作方法。F 通過查詢手冊和文獻資料,培養(yǎng)學(xué)生獨立分析問題和解決問題的能力。G 初步掌握開發(fā)一個小型實用系統(tǒng)的基本方法。H 培養(yǎng)學(xué)生的創(chuàng)新能力和創(chuàng)新思維。I 培養(yǎng)學(xué)生良好的程序設(shè)計風(fēng)格。進一步理解和運用2.課程設(shè)計題目及內(nèi)容教師工資管理系統(tǒng)每個教師的信息為:教師名,姓名,性別,單位名稱,家庭住址,聯(lián)系電話,基本工資,津貼,生活補貼,應(yīng)發(fā)工資,電話費,水電費,房租,所得稅,衛(wèi)生費,公積金,合計扣款,實發(fā)工資。注:應(yīng)發(fā)工資=基本工資+津貼+生活補貼;合計扣款=電話費+水電費+房租+所得稅+

4、衛(wèi)生費+公積金;實發(fā)工資=應(yīng)發(fā)工資合計扣款。1教師信息處理J 輸入教師信息K 插入(修改)教師信息L 刪除教師信息;M 瀏覽教師信息;(提示:具體功能及操作參考題1。)2教師數(shù)據(jù)處理;A. 按教師號錄入教師基本工資,津貼,生活補貼,電話費,水電費,房租,所得稅,衛(wèi)生費,公積金等基本信息;B. 教師實發(fā)工資、應(yīng)發(fā)公資、合計扣款;C. 教師數(shù)據(jù)管理;(提示:輸入教師號,讀出并顯示該教師信息,輸入新數(shù)據(jù),將改后信息寫入文件。)D. 教師數(shù)據(jù)查詢;(提示:輸入教師好或其他信息,即讀出所有數(shù)據(jù)信息,并顯示出來。)E. 教師綜合信息輸出;(提示;輸出教師信息到屏幕。)一、 需求分析 教師信息處理A輸入教師

5、信息B插入修改教師信息C刪除教師信息D瀏覽教師信息 教師數(shù)據(jù)處理A按教師號錄入教師基本工資、津貼、生活補貼、電話費、水電費、房租、所得稅、衛(wèi)生費、公積金等基本數(shù)據(jù)。B教師實發(fā)工資,應(yīng)發(fā)工資,合計扣款計算。C教師數(shù)據(jù)管理D教師數(shù)據(jù)查詢E教師綜合信息輸出二總體設(shè)計4總體設(shè)計、輸出界面選擇操作選擇0讀取文件執(zhí)行freeall()退出系統(tǒng)選擇1輸入數(shù)據(jù)Break結(jié)束選擇2瀏覽數(shù)據(jù)break選擇3查詢數(shù)據(jù)Break選擇4選擇5刪除數(shù)據(jù)修改數(shù)據(jù)BreakBreak輸出:無效選項Break結(jié)束建立動態(tài)鏈表。開辟一個新結(jié)點,并使p1,p2指向它讀入一個老師數(shù)據(jù)給P1所指的結(jié)點head=NULL n=0當(dāng)讀入的

6、p1->num!=0表尾結(jié)點的指針變量置NULLn=n+1真 n=1 假head=p1 p2->next=p1把p1所指的結(jié)點把p1所指的結(jié)點作為第一結(jié)點連接到表尾p2=p1在開辟一個新結(jié)點,使p1指向它讀入一個老師數(shù)據(jù)給p1所指結(jié)點刪除結(jié)點真鏈表是一個空表假 p1=head當(dāng)num!=p1->num以及p1所指的結(jié)點不是表尾結(jié)點結(jié)點 p2=p1 p1=p1->next是 p1是要刪除的結(jié)點否是 p1所指的頭結(jié)點否輸出找 head=p1->next p2->next= 不到的信息 p1->next 息輸出空表插入結(jié)點p1=head,p0=stud是原來

7、的鏈表是空表否當(dāng)p0->num>p1->num以及p1所指的不是表尾結(jié)點將p0所 p2指向p1位置指的結(jié) p1向后移一個結(jié)點點作為 p0->num<=p1->num唯一的真假結(jié)點是p1指向頭結(jié)點否 p1->next=p0head=p0 p2->next=p0 p0->next=NULL p0->next=p1 p0->next=p1修改調(diào)用query函數(shù)查找到相關(guān)結(jié)點地址修改相關(guān)結(jié)點的值域是否存在該教師信息修改完畢三、詳細設(shè)計源程序#include<stdio.h>#include<stdlib.h>#i

8、nclude<conio.h>#define LEN sizeof(struct teacher)struct teacher *creat();struct teacherintnum;char name10;char sex8;char unit10;char address10;longtelnum;float salary_1;float allowance;floatlife_allow;float salary_2;floattel_fee;float tax;floathealth_fee;floatwater_fee;float rent;float grant;f

9、loattotal_fee;floatactual_salary;struct teacher *next;int n;struct teacher *head;FILE *fp;struct teacher *creat(void)struct teacher *p1,*p2;n=0;p1=p2=(struct teacher *)malloc(LEN);printf("教師號:");scanf("%d",&p1->num);fflush(stdin);printf("教師姓名:");gets(p1->name)

10、;printf("教師性別:");gets(p1->sex);printf("單位名稱:");gets(p1->unit);printf("家庭地址:");gets(p1->address);printf("電話號碼:");scanf("%ld",&p1->telnum);fflush(stdin);printf("基本工資:");scanf("%f",&p1->salary_1);fflush(stdin);

11、printf("津貼:");scanf("%f",&p1->allowance);fflush(stdin);printf("生活補貼:");scanf("%f",&p1->life_allow);fflush(stdin);printf("電話費:");scanf("%f",&p1->tel_fee);fflush(stdin);printf("個人所得稅:");scanf("%f",&

12、;p1->tax);fflush(stdin);printf("房租:");scanf("%f",&p1->rent);fflush(stdin);printf("公積金:");scanf("%f",&p1->grant);fflush(stdin);printf("水電費:");scanf("%f",&p1->water_fee);fflush(stdin);printf("衛(wèi)生費:");scanf(&qu

13、ot;%f",&p1->health_fee);fflush(stdin); p1->salary_2=p1->salary_1+p1->allowance+p1->life_allow; p1->total_fee=p1->tel_fee+p1->water_fee+p1->rent+p1->tax+p1->health_fee+p1->grant; p1->actual_salary=p1->salary_2-p1->total_fee; head=NULL;while(p1->

14、;num!=0)n=n+1;if(n=1)head=p1;else p2->next=p1;p2=p1;p1=(struct teacher*)malloc(LEN);printf("教師號:");scanf("%d",&p1->num);fflush(stdin);printf("教師姓名:");gets(p1->name);printf("教師性別:");gets(p1->sex);printf("單位名稱:");gets(p1->unit);print

15、f("家庭地址:");gets(p1->address);printf("電話號碼:");scanf("%ld",&p1->telnum);fflush(stdin);printf("基本工資:");scanf("%f",&p1->salary_1);fflush(stdin);printf("津貼:");scanf("%f",&p1->allowance);fflush(stdin);printf(&quo

16、t;生活補貼:");scanf("%f",&p1->life_allow);fflush(stdin);printf("電話費:");scanf("%f",&p1->tel_fee);fflush(stdin);printf("個人所得稅:");scanf("%f",&p1->tax);fflush(stdin);printf("房租:");scanf("%f",&p1->rent);ffl

17、ush(stdin);printf("公積金:");scanf("%f",&p1->grant);fflush(stdin);printf("水電費:");scanf("%f",&p1->water_fee);fflush(stdin);printf("衛(wèi)生費:");scanf("%f",&p1->health_fee);fflush(stdin); p1->salary_2=p1->salary_1+p1->all

18、owance+p1->life_allow; p1->total_fee=p1->tel_fee+p1->water_fee+p1->rent+p1->tax+p1->health_fee+p1->grant; p1->actual_salary=p1->salary_2-p1->total_fee; p2->next=NULL;return(head);void print(struct teacher *head)struct teacher *p;printf("nNow,These %d records

19、are:n",n);p=head;if(head!=NULL)doprintf("教師號:%5dtt",p->num);printf("教師姓名:%-10sn",p->name);printf("教師性別:%-6stt",p->sex);printf("單位名稱:%-10sn",p->unit);printf("家庭地址:%-10st",p->address);printf("電話號碼:%8ldn",p->telnum);prin

20、tf("基本工資:%5.0ftt",p->salary_1);printf("津貼:%5.0fn",p->allowance);printf("生活補貼:%5.0ft",p->life_allow);printf("t電話費:%5.0fn",p->tel_fee);printf("個人所得稅:%5.0ft",p->tax);printf("衛(wèi)生費:%5.0fn",p->health_fee);printf("水電費:%5.0ftt

21、",p->water_fee);printf("房租:%5.0fn",p->rent);printf("公積金:%5.0ftt",p->grant);printf("應(yīng)發(fā)工資:%5.0fn",p->salary_2);printf("合計扣款:%5.0ftt",p->total_fee);printf("實發(fā)工資:%5.0fnnn",p->actual_salary);p=p->next;while(p!=NULL);struct teache

22、r *insert(struct teacher*head,struct teacher *teach)struct teacher *p0,*p1,*p2;p1=head;p0=teach;if(head=NULL)head=p0;p0->next=NULL;elsewhile(p0->num>p1->num)&&(p1->next!=NULL)p2=p1;p1=p1->next;if(p0->num<p1->num)if(head=p1)head=p0;else p2->next=p0;p0->next=p1

23、;elsep1->next=p0;p0->next=NULL;n=n+1;return(head);struct teacher *del(struct teacher *head,int number)struct teacher *p1,*p2;if(head=NULL)printf("nlist nulln");return(head);p1=head;while(number!=p1->num&&p1->next!=NULL)p2=p1;p1=p1->next;if(number=p1->num)if(p1=hea

24、d)head=p1->next;else p2->next=p1->next;printf("刪除:%dn",number);n=n-1;else printf("%ld is not foundn",number);return(head);void save() int i;struct teacher *p1; p1=head; if(fp=fopen("teacher_list","wb")=NULL) printf("cannot open filen"); retu

25、rn; for(i=0;i<n;i+) if(fwrite(p1,sizeof(struct teacher),1,fp)!=1)printf(" errorn"); p1=p1->next; fclose(fp);void load()struct teacher *p1,*p2;if(fp=fopen("teacher_list","rb")=NULL) printf("cannot open filen"); return; p1=p2=(struct teacher *)malloc(LEN);

26、head=p1;do if(fread(p1,sizeof(struct teacher),1,fp)!=1) printf("file errorn");goto end; if(p1->next!=NULL) p2=p1; p1=(struct teacher *)malloc(LEN); p2->next=p1; else break; while(1); end: fclose(fp);void query(struct teacher *p) int no;p=head;printf("please input num:n");sc

27、anf("%d",&no); while(p->num!=no)p=p->next;printf("基本工資:%5.0ftt",p->salary_1);printf("津貼:%5.0fn",p->allowance);printf("生活補貼:%5.0ft",p->life_allow);printf("t電話費:%5.0fn",p->tel_fee);printf("個人所得稅:%5.0ft",p->tax);printf

28、("衛(wèi)生費:%5.0fn",p->health_fee);printf("水電費:%5.0ftt",p->water_fee);printf("房租:%5.0fn",p->rent);printf("公積金:%5.0ftt",p->grant);printf("應(yīng)發(fā)工資:%5.0fn",p->salary_2);printf("合計扣款:%5.0ftt",p->total_fee);printf("實發(fā)工資:%5.0fnnn&qu

29、ot;,p->actual_salary);void edit(struct teacher *p)int a;printf("please input num:n");scanf("%d",&a);printf("%dnn",a);for(;)if(p->num=a)printf("教師號:%5dtt",p->num);printf("教師姓名:%-10sn",p->name);printf("教師性別:%-6stt",p->sex);

30、printf("單位名稱:%-10sn",p->unit);printf("家庭地址:%-10st",p->address);printf("電話號碼:%8ldn",p->telnum);printf("基本工資:%5.0ftt",p->salary_1);printf("津貼:%5.0fn",p->allowance);printf("生活補貼:%5.0ft",p->life_allow);printf("t電話費:%5.0fn

31、",p->tel_fee);printf("個人所得稅:%5.0ft",p->tax);printf("衛(wèi)生費:%5.0fn",p->health_fee);printf("水電費:%5.0ftt",p->water_fee);printf("房租:%5.0fn",p->rent);printf("公積金:%5.0ftt",p->grant);printf("應(yīng)發(fā)工資:%5.0fn",p->salary_2);printf(

32、"合計扣款:%5.0ftt",p->total_fee);printf("實發(fā)工資:%5.0fnnn",p->actual_salary);printf("請輸入新數(shù)據(jù):n");printf("教師號:");scanf("%d",&p->num);fflush(stdin);printf("教師姓名:"); gets(p->name);printf("教師性別:"); gets(p->sex);printf("

33、;工作單位:"); gets(p->unit);printf("家庭地址:"); gets(p->address);printf("電話號碼:");scanf("%ld",&p->telnum);fflush(stdin);printf("基本工資:");scanf("%f",&p->salary_1);fflush(stdin);printf("津貼:");scanf("%f",&p->al

34、lowance);fflush(stdin);printf("生活補貼:");scanf("%f",&p->life_allow);fflush(stdin);printf("電話費:");scanf("%f",&p->tel_fee);fflush(stdin);printf("個人所得稅:");scanf("%f",&p->tax);fflush(stdin);printf("房租:");scanf("

35、;%f",&p->rent);fflush(stdin);printf("公積金:");scanf("%f",&p->grant);fflush(stdin);printf("水電費:");scanf("%f",&p->water_fee);fflush(stdin);printf("衛(wèi)生費:");scanf("%f",&p->health_fee);fflush(stdin); p->salary_2=

36、p->salary_1+p->allowance+p->life_allow; p->total_fee=p->tel_fee+p->water_fee+p->rent+p->tax+p->health_fee+p->grant; p->actual_salary=p->salary_2-p->total_fee; break; p=p->next;void welcome() printf("ttt+-+n"); printf("ttt| |n"); printf(&q

37、uot;ttt| 歡迎使用教師工資管理系統(tǒng) |n"); printf("ttt| |n"); printf("ttt+-+n"); printf("nn"); char mainmenu() char choice;printf("n溫馨提示:為保證您的操作得到保存,請按正常順序退出系統(tǒng)_n");printf("nn"); printf("ttt-n"); printf("ttt| 教師工資管理系統(tǒng) |n"); printf("ttt-

38、n"); printf("ttt| 1-輸入教師信息 |n"); printf("ttt| 2-插入教師信息 |n"); printf("ttt| 3-刪除教師信息 |n"); printf("ttt| 4-瀏覽教師信息 |n"); printf("ttt| 5-錄入教師信息 |n");printf("ttt| 6-查詢教師信息 |n"); printf("ttt| 7-修改教師信息 |n");printf("ttt| 8-加載教師信息

39、 |n");printf("ttt| 0-退出系統(tǒng) |n"); printf("ttt|*·*·*·*·*·*·*·*·*·*·|n"); printf("ttt-n"); printf("請輸入您的選擇:"); dofflush(stdin);scanf("%c",&choice);fflush(stdin);while(choice<'0'|choice

40、>'8');return(choice);void main()struct teacher *teach;intdel_num;char choice;while(1)welcome(); choice=mainmenu();switch(choice) case '0': system("cls");exit(0); case '1': printf("input records:n");head=creat();break; case '2':printf("input

41、 the inserted record:n");teach=(struct teacher *)malloc(LEN);printf("教師號:");scanf("%d",&teach->num);fflush(stdin);printf("教師姓名:"); gets(teach->name);printf("教師性別:"); gets(teach->sex);printf("單位名稱:"); gets(teach->unit);printf(&quo

42、t;家庭地址:"); gets(teach->address);printf("電話號碼:");scanf("%ld",&teach->telnum);fflush(stdin);printf("基本工資:");scanf("%f",&teach->salary_1);fflush(stdin);printf("津貼:");scanf("%f",&teach->allowance);fflush(stdin);printf("生活補貼:");scanf("%f",&teach->life_allow);fflush(stdin);printf("電話費:");scanf("%f",&teach->tel_fee);fflush(std

溫馨提示

  • 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)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論