職工工資管理系統(tǒng)C程序_第1頁
職工工資管理系統(tǒng)C程序_第2頁
職工工資管理系統(tǒng)C程序_第3頁
職工工資管理系統(tǒng)C程序_第4頁
職工工資管理系統(tǒng)C程序_第5頁
已閱讀5頁,還剩20頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、/* 職工工資管理小軟件 */#include<stdio.h>#include<string.h>#include<conio.h>#include<stdlib.h>#define N 20int NN;/* 函數(shù)聲明*/void enter();int menu();void input();void output();void search();void search_employeeid();void search_name();void edit();void array();void array_basesalary();void

2、array_postwage();void array_totalwage();void array_yiliaobaoxian();void array_gongjijin();void statistics();void save();void load();void del();void delE();void delName();/* 職工類型定義*/struct employeechar employeeid10;char name10;int sex;int age;float basesalary;float postwage;float yiliaobaoxian;float

3、gongjijin;float totalwage;/* 職工變量定義*/struct employee empN;struct employee replace;struct employee *p=emp;/* 系統(tǒng)主函數(shù)*/void main()int c;while(1)printf(" nnnn"); printf(" 歡迎進(jìn)入職工工資管理系統(tǒng) nnn");printf(" 1 進(jìn)入管理系統(tǒng) nn");printf(" 0 退出 nn");printf(" nnnn");printf(

4、" 請(qǐng)輸入你選擇: n");scanf("%d",&c);switch(c) case 1: enter(); break; case 0: printf(" 謝謝使用!n"); exit(0); /* 功能:登陸函數(shù),進(jìn)行密碼驗(yàn)證*/void enter() char key10,password10="1"int k=1;printf(" 請(qǐng)輸入密碼: n");scanf("%s",key);while(k<=3)if(strcmp(password,key

5、)=0)while(1) int a; /system("cls"); a=menu();switch(a) case 1: input();break;case 2: output();break;case 3: search();break;case 4: edit();break;case 5: array();break;case 6: load();statistics();break; case 7: del();break;case 0: printf("nn 謝謝使用!nnnn"); save(); exit(0);else k+;pri

6、ntf(" 輸入密碼錯(cuò)誤!請(qǐng)?jiān)俅屋斎?");scanf("%s",key);if(k>2) if(strcmp(password,key)=0) continue;else printf(" 輸入密碼錯(cuò)誤三次,系統(tǒng)將自動(dòng)退出!n"); exit(0);/*功能: 主菜單函數(shù)參數(shù):a 類型:int說明: 變量返回值: a*/int menu()int a ;printf("nn");printf("|*歡迎進(jìn)入職工工資管理系統(tǒng)*|n");printf("| |n");pr

7、intf("| |n");printf("| 1 輸入職工信息 |n");printf("| |n");printf("| 2 職工信息輸出 |n"); printf("| |n");printf("| 3 職工信息查詢 |n"); printf("| |n"); printf("| 4 修改職工信息 |n"); printf("| |n"); printf("| 5 工資排序 |n"); pri

8、ntf("| |n"); printf("| 6 工資統(tǒng)計(jì) |n"); printf("| |n"); printf("| 7 刪除職工信息 |n"); printf("| |n"); printf("| 0 退出 |n"); printf("| |n"); printf("| |n"); printf("|* 電氣信息1032 王利波 *|n");printf("nn");printf(&quo

9、t; 請(qǐng)輸入你所選擇的選項(xiàng):");scanf("%d",&a);while(a>7|a<0)printf(" error!n"); printf(" 請(qǐng)重新輸入你所選擇的選項(xiàng):");scanf("%d",&a);return a;/*功能:職工信息輸入*/void input()int c;p=emp;printf(" 進(jìn)入職工信息輸入模塊 nnn");printf(" 請(qǐng)輸入增加職工的數(shù)量: nnn");scanf("%d&q

10、uot;,&NN);for(c=0;c<NN;c+,p+) pc.totalwage=pc.basesalary+pc.postwage-pc.yiliaobaoxian-pc.gongjijin;printf(" 請(qǐng)輸入第%d個(gè)職工信息:nn",c+1);printf(" 請(qǐng)輸入職工號(hào):n");scanf("%s",p->employeeid);if(strcmp(p->employeeid,"0")!=0) printf(" 請(qǐng)輸入職工姓名:n");scanf(&q

11、uot;%s",p->name);printf(" 請(qǐng)輸入職工性別: n");scanf("%d",&p->sex);printf(" 請(qǐng)輸入職工年齡: n");scanf("%d",&p->age);printf(" 請(qǐng)輸入職工基本工資:n");scanf("%f",&p->basesalary);printf(" 請(qǐng)輸入職工崗位工資:n");scanf("%f",&p

12、->postwage);printf(" 請(qǐng)輸入職工醫(yī)療保險(xiǎn):n"); scanf("%f",&p->yiliaobaoxian);printf(" 請(qǐng)輸入職工公積金: n");scanf("%f",&p->gongjijin); printf(" 職工信息輸入完成! nn");elsereturn;save();/*功能:職工信息輸出*/void output() int j;load();p=emp; printf(" 進(jìn)入職工信息輸出模塊 nnn

13、"); printf("-n");printf("|職工號(hào) |姓名 |性別 |年齡 |基本工資 |崗位工資 |醫(yī)療保險(xiǎn) |公積金 |總工資 |n");printf("-n");for(j=0;j<NN;j+)pj.totalwage=pj.postwage+pj.basesalary-pj.yiliaobaoxian-pj.gongjijin;printf("|%8s|%7s|%5d|%5d| %7.2f| %7.2f| %7.2f| %7.2f|%7.2f|n",pj.employeeid,pj.

14、name,pj.sex,pj.age,pj.basesalary,pj.postwage,pj.yiliaobaoxian,pj.gongjijin,pj.totalwage);printf("-n");printf("nn 職工信息輸出完成! nn");getchar(); /*功能:職工信息查詢*/void search()int j; while(1) printf("*職工信息查詢*nnn");printf(" 1 按職工號(hào)查詢 n");printf(" 2 按職工姓名查詢 n");pr

15、intf(" 0 退出該項(xiàng)操作 n");printf("nn");while(1)printf(" 請(qǐng)輸入你的選擇 n");scanf("%d",&j);if(j>=0&&j<=2)switch(j)case 1:search_employeeid();break;case 2:search_name();break;case 0:return;elseprintf(" 輸入錯(cuò)誤! nn");printf(" 請(qǐng)?jiān)俅屋斎肽愕倪x擇: nn")

16、;/*功能:按職工號(hào)查詢函數(shù)*/void search_employeeid()char employeeid10;int k,j;p=emp;printf("*按職工號(hào)查詢職工信息*nnnn");printf(" 請(qǐng)輸入要查詢職工的職工號(hào): nn");scanf("%s",employeeid);for(k=0;k<NN;k+)if(strcmp(employeeid,p->employeeid)=0)j=k; pj.totalwage=pj.postwage+pj.basesalary-pj.yiliaobaoxian

17、-pj.gongjijin;printf("-n");printf("|職工號(hào) |姓名 |性別 |年齡 |基本工資 |崗位工資 |醫(yī)療保險(xiǎn) |公積金 |總工資 |n");printf("|%8s|%7s|%5d|%5d| %7.2f| %7.2f| %7.2f| %7.2f|%7.2f|n",pj.employeeid,,pj.sex,pj.age,pj.basesalary,pj.postwage,pj.yiliaobaoxian,pj.gongjijin,pj.totalwage);printf("-n&q

18、uot;);break; elseprintf(" not foundn");return;/*功能:按職工姓名查詢函數(shù)*/void search_name()char name10;int flog=0;int f,j;p=emp;printf("*按職工姓名查詢職工信息*nnn");printf(" 請(qǐng)輸入要查詢職工的姓名: nn");scanf("%s",name); for(f=0;f<NN;f+,p+)if(strcmp(name,p->name)=0)j=f; pj.totalwage=pj

19、.postwage+pj.basesalary-pj.yiliaobaoxian-pj.gongjijin; printf("-n");printf("|職工號(hào) |姓名 |性別 |年齡 |基本工資 |崗位工資 |醫(yī)療保險(xiǎn) |公積金 |總工資 |n");printf("|%8s|%7s|%5d|%5d| %7.2f| %7.2f| %7.2f| %7.2f|%7.2f|n",pj.employeeid,,pj.sex,pj.age,pj.basesalary,pj.postwage,pj.yiliaobaoxian,pj.

20、gongjijin,pj.totalwage);printf("-n");break;elseprintf(" not found nn"); return;getchar();/*功能:職工信息修改函數(shù)*/void edit()char e10;int g=0,j;char flog; p=emp;printf(" 請(qǐng)輸入你要修改職工的職工號(hào): n");scanf("%s",e);for(g=0;g<NN;g+) /if(*e=pg.employeeid)if(strcmp(e,p->employee

21、id)=0) j=g; pj.totalwage=pj.postwage+pj.basesalary-pj.yiliaobaoxian-pj.gongjijin; printf("-n"); printf("|職工號(hào) |姓名 |性別 |年齡 |基本工資 |崗位工資 |醫(yī)療保險(xiǎn) |公積金 |總工資 |n"); printf("|%8s|%7s|%5d|%5d| %7.2f| %7.2f| %7.2f| %7.2f|%7.2f|n",pj.employeeid,,pj.sex,pj.age,pj.basesalary,pj.

22、postwage,pj.yiliaobaoxian,pj.gongjijin,pj.totalwage); printf("-n"); printf(" 是否要修改該職工信息?y(是)or n(否)?nn"); getchar(); scanf("%c",&flog); if(flog = 'y') printf(" 請(qǐng)輸入新姓名:n"); scanf("%s",p->name); printf(" 請(qǐng)輸入性別: n"); scanf("

23、;%d",&p->sex); printf(" 請(qǐng)輸入年齡: n"); scanf("%d",&p->age); printf(" 請(qǐng)輸入基本工資:n"); scanf("%f",&p->basesalary); printf(" 請(qǐng)輸入崗位工資:n"); scanf("%f",&p->postwage); printf(" 請(qǐng)輸入職工醫(yī)療保險(xiǎn):n"); scanf("%f&quo

24、t;,&p->yiliaobaoxian); printf(" 請(qǐng)輸入職工公積金: n"); scanf("%f",&p->gongjijin); printf(" 修改職工信息成功! nn"); if(flog = 'n')printf(" 退出該項(xiàng)操作! nn");return;save(); if(g=NN)printf(" not found nnn");return;/*功能:職工工資排列函數(shù)*/void array()int j;while

25、(1)printf("*工資排序*nn");printf(" 1 按基本工資排序 nn");printf(" 2 按崗位工資排序 nn"); printf(" 3 按總工資排序 nn"); printf(" 4 按醫(yī)療保險(xiǎn)排序 nn"); printf(" 5 按公積金排序 nn"); printf(" 0 退出 nn");printf("nnn");while(1) printf(" 請(qǐng)輸入你的選擇: nn");

26、scanf("%d",&j); if(j>=0&&j<=5) switch(j) case 1: array_basesalary();break; case 2: array_postwage();break; case 3: array_totalwage();break; case 4: array_yiliaobaoxian();break; case 5: array_gongjijin();break; case 0: return; else printf(" 輸入錯(cuò)誤!nnn"); printf(&qu

27、ot; 請(qǐng)?jiān)俅屋斎肽愕倪x擇:nn"); /*功能:按基本工資排列(選擇法)*/void array_basesalary()int i,j,k; p=emp;for(i=0;i<NN-1;i+) k=i;for(j=i+1;j<NN;j+)if(pk.basesalary<pj.basesalary)k=j;if(k!=i) replace=empk;empk=empi;empi=replace; for(j=0;j<NN;j+)pj.totalwage=pj.postwage+pj.basesalary-pj.yiliaobaoxian-pj.gongjij

28、in;printf("-n");printf("|職工號(hào) |姓名 |性別 |年齡 |基本工資 |崗位工資 |醫(yī)療保險(xiǎn) |公積金 |總工資 |n");printf("|%8s|%7s|%5d|%5d| %7.2f| %7.2f| %7.2f| %7.2f|%7.2f|n",pj.employeeid,,pj.sex,pj.age,pj.basesalary,pj.postwage,pj.yiliaobaoxian,pj.gongjijin,pj.totalwage);printf("-n");/*功能:

29、按崗位工資排列(冒泡法)*/void array_postwage()int i,j;p=emp; for(i=0;i<NN;i+)for(j=0;j<NN-i;j+) if(pj.postwage<pj+1.postwage) replace=empj;empj=empj+1;empj+1=replace; for(j=0;j<NN;j+)pj.totalwage=pj.postwage+pj.basesalary-pj.yiliaobaoxian-pj.gongjijin;printf("-n");printf("|職工號(hào) |姓名 |性

30、別 |年齡 |基本工資 |崗位工資 |醫(yī)療保險(xiǎn) |公積金 |總工資 |n"); printf("|%8s|%7s|%5d|%5d| %7.2f| %7.2f| %7.2f| %7.2f|%7.2f|n",pj.employeeid,,pj.sex,pj.age,pj.basesalary,pj.postwage,pj.yiliaobaoxian,pj.gongjijin,pj.totalwage);printf("-n");/*功能:按醫(yī)療保險(xiǎn)排列(冒泡法)*/void array_yiliaobaoxian()int i,j;p

31、=emp; for(i=0;i<NN;i+)for(j=0;j<NN-i;j+) if(pj.yiliaobaoxian<pj+1.yiliaobaoxian) replace=empj;empj=empj+1;empj+1=replace; for(j=0;j<NN;j+)pj.totalwage=pj.postwage+pj.basesalary-pj.yiliaobaoxian-pj.gongjijin;printf("-n");printf("|職工號(hào) |姓名 |性別 |年齡 |基本工資 |崗位工資 |醫(yī)療保險(xiǎn) |公積金 |總工資

32、|n"); printf("|%8s|%7s|%5d|%5d| %7.2f| %7.2f| %7.2f| %7.2f|%7.2f|n",pj.employeeid,,pj.sex,pj.age,pj.basesalary,pj.postwage,pj.yiliaobaoxian,pj.gongjijin,pj.totalwage);printf("-n");/*功能:按公積金排列(選擇法)*/void array_gongjijin()int i,j,k; p=emp;for(i=0;i<NN-1;i+) k=i;for(j

33、=i+1;j<NN;j+)if(pk.gongjijin<pj.gongjijin)k=j;if(k!=i) replace=empk;empk=empi;empi=replace; for(j=0;j<NN;j+)pj.totalwage=pj.postwage+pj.basesalary-pj.yiliaobaoxian-pj.gongjijin;printf("-n");printf("|職工號(hào) |姓名 |性別 |年齡 |基本工資 |崗位工資 |醫(yī)療保險(xiǎn) |公積金 |總工資 |n"); printf("|%8s|%7s|%5d|%5d| %7.2f| %7.2f| %7.2f| %7.2

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(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ǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論