




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、. . . . #include<string.h>#include<stdio.h>#define N 10000 /*員工的最大數(shù)*/typedef struct wagefloat wage1; /*員工的基本工資*/float Bonus; /*員工的獎(jiǎng)金*/float tax; /*員工的稅金*/float S_fee;
2、160; /*員工的水費(fèi)*/float D_fee; /*員工的電費(fèi)*/float T_fee; /*員工的有線電視費(fèi)*/float Q_fee; /*員工的清潔費(fèi)*/float S_wage; /*員工的實(shí)發(fā)工資*/WAGE;typedef struct worker char name10;
3、160; /*員工的*/char ID10; /*員工的工號(hào)*/ int ID_P; /*員工的職務(wù)代號(hào) 1-高級(jí)工程師 2-中級(jí)工程師 3-初級(jí)工程師 *
4、/char ID_Wage10; /*員工的工資卡號(hào)*/char depart10; /*員工的部門(mén)*/ int age; /*員工的年齡*/char sex; /*員工的性別*/char m_phone
5、10; /*員工的手機(jī)*/char H_phone10; /*員工的住宅*/ WAGE salary;WORK;WORK woN;int n;/*員工的總數(shù)*/void menu();/*員工管理操作主菜單函數(shù)聲明*/void menu1();/*員工管理操作子菜單函數(shù)聲明*/*Author : GTCopyRight : tgaosohu.
6、60; function name : save Comments : 保存文件函數(shù)input : 無(wú) output
7、0; : 無(wú)CreatedDate : 2007/06/01*/save() /*保存函數(shù),保存n個(gè)記錄*/ int w=1;FILE *fp;int i;system( "cls&q
8、uot; ); if(fp=fopen("work.txt","wb")=NULL) /*以輸出打開(kāi)方式,在此前的記錄被覆蓋*/ printf("nCannot open filen"); return NULL; for(i=0;i<n;i+)if(fwrite(&woi,sizeof(struct worker),1,
9、fp)!=1) printf("file write errorn"); w=0;if(w=1) printf("file save ok!n");fclose(fp);getch(); menu();/*Author
10、0; : GTCopyRight : tgaosohu. function name : load Comments : 載入文件函數(shù)input : 無(wú)
11、0; output : 無(wú)CreatedDate : 2007/06/01*/load()
12、0; /*加載記錄或可以計(jì)算記錄個(gè)數(shù)的函數(shù)*/FILE *fp;int i,w;w=1;system( "cls" ); if(fp=fopen("work.txt","rb")=NULL) /*以輸出打開(kāi)方式,在此前的記錄被覆蓋*/ printf("nCannot open filen"); w=0; return NULL;
13、n=0;for(i=0;!feof(fp);i+) fread(&woi,sizeof(struct worker),1,fp); n+;n=n-1;fclose(fp);if(w=1) printf("Load file ok!");getch(); menu();return(i-1);
14、60; /*返回記錄個(gè)數(shù)*/*Author : GTCopyRight : tgaosohu. function name : no_input Comments : 輸入不能重復(fù)的員工編號(hào)inp
15、ut : i:表示第i個(gè)的員工編號(hào)信息 n:表示比較到第n個(gè)員工編號(hào)信息output : 無(wú)CreatedDate : 2007/06/01*/
16、void no_input(int i,int n) /*i表示第i個(gè)的員工編號(hào)信息,n表示比較到第n個(gè)員工編號(hào)*/int j,k,w1;do w1=0; printf("NO.:");
17、; scanf("%s",woi.ID); for(j=0;woi.IDj!='0'j+) /*員工編號(hào)輸入函數(shù),作了嚴(yán)格規(guī)定*/ if(woi.IDj<'0'|woi.IDj>'9') /*判斷員工編號(hào)是否
18、為數(shù)字*/ puts("Input error! Only be made up of (0-9).Please reinput!n"); w1=1; break;
19、60; if(w1!=1) for(k=0;k<n;k+) /*比較到第n個(gè)員工編號(hào)*/
20、 /*排除第i個(gè)員工編號(hào)即你要修改的*/ if(k!=i&&am
21、p;strcmp(wok.IDj,woi.IDj)=0) /*判斷員工編號(hào)是否有雷同*/ puts("This record is exist. please reinput!n");
22、; w1=1; break; while(w1=1);/*Author : GTCopyRight : tgaosohu. function name : tax Comments : 工資稅金i
23、nput : s: 表示員工工資信息output : 員工的稅金CreatedDate : 2007/06/01*/float tax(float s)float ta
24、x;if(s<=800) tax=0;else if(s>800&&s<=1400) tax=(s-800)*0.05; else if(s>1400) tax=(s-1400)*0.1+600*0.05; return tax;/*Author : GTCopyRight
25、; : tgaosohu. function name : input Comments : 輸入一條員工記錄input : i: 表示第i個(gè)的員工信息output
26、0; : 無(wú)CreatedDate : 2007/06/01*/void input(int i)
27、; /*輸入一個(gè)記錄函數(shù)*/ int j,sum; no_input(i,i); /*調(diào)用員工編號(hào)輸入函數(shù)*/
28、; printf("name:");fflush(stdin);gets();printf("Bank ID:");fflush(stdin);gets(woi.ID_Wage);printf("grade");scanf("%d",&woi.ID_P); printf("Department:");fflush(stdin);gets(woi.depart); printf("age:&qu
29、ot;);scanf("%d",&woi.age); printf("sex:");fflush(stdin);scanf("%c",&woi.sex); printf("mobile phone");fflush(stdin);gets(woi.m_phone); printf("home phone"
30、;);fflush(stdin);gets(woi.H_phone);printf("basic salary");scanf("%f",&woi.salary.wage1);woi.salary.tax=tax(woi.salary.wage1);printf("Bonus:");scanf("%f",&woi.salary.Bonus);printf("water fee:");scanf("%f",&woi.salary.S_fee);print
31、f("dian fee:");scanf("%f",&woi.salary.D_fee);printf("QingJie fee:");scanf("%f",&woi.salary.Q_fee);printf("TV fee:");scanf("%f",&woi.salary.T_fee); woi.salary.S_wage=woi.salary.wage1+woi.salary.Bonus
32、-woi.salary.tax-woi.salary.D_fee-woi.salary.Q_fee-woi.salary.S_fee-woi.salary.T_fee;/*Author : GTCopyRight : tgaosohu. function name : enter Comments : 輸入員工管理
33、系統(tǒng)信息記錄input : 無(wú)output : 無(wú)CreatedDate : 2007/06/01*/void enter()/*輸入模塊*/int i;system( "
34、;cls" ); printf("How many record(0-%d)?:",N);scanf("%d",&n); /*要輸入的記錄個(gè)數(shù)*/printf("nEnter data nownn");for(i=0;i<n;i+)
35、; printf("nInput %dth record.n",i+1); input(i); /*調(diào)用輸入函數(shù)*/ getch(); m
36、enu();/*Author : GTCopyRight : tgaosohu. function name : printf_one Comments : 輸出一條員工信息記錄input
37、0; : i:表示第i個(gè)的員工信息output : 無(wú)CreatedDate : 2007/06/01*/void printf_one(int i)
38、60; /*顯示一個(gè)記錄的函數(shù)*/int j;printf("%11s %-6s %-6s %d %d %c %6.2f %s
39、0; %s",woi.ID,,woi.ID_Wage,woi.ID_P,woi.age,woi.sex,woi.salary.S_wage,woi.m_phone,woi.H_phone);/*Author : GTCopyRight : tgaosohu. function name : printf_one_s
40、0; Comments : 輸出一條員工工資記錄input : i:表示第i個(gè)的工資信息output : 無(wú)CreatedDate :
41、 2007/06/01*/void printf_one_s(int i) /*顯示一個(gè)記錄的函數(shù)*/int j;printf(" %8.2f
42、160; %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f %8.2f",woi.salary.wage1,woi.salary.S_wage,woi.salary.Bonus,woi.salary.D_fee,woi.salary.Q_fee,woi.salary.S_fee,woi.salary.T_fee,woi.salary.ta
43、x);/*Author : GTCopyRight : tgaosohu. function name : browse Comments : 輸出員工管理系統(tǒng)信息記錄input
44、60; : 無(wú)output : 無(wú)CreatedDate : 2007/06/01*/void browse()
45、0; /*瀏覽(全部)模塊*/int i,j;system( "cls" ); puts("n-");printf("nt工號(hào) 銀行卡號(hào) 職稱 年齡 性別 實(shí)發(fā)工資 手機(jī) 住宅n");for(i=0;i<n;i+) if(i!=0)&&(i%1
46、0=0) /*目的是分屏顯示*/ printf("nnPass any key to contiune . . .");
47、getch(); puts("nn"); printf_one(i); /*調(diào)用顯示一個(gè)記錄的函數(shù)*/ printf("n")
48、;puts("n-");printf("tThere are %d record.n",n);getch(); /*按任意健*/menu();/*Author
49、60; : GTCopyRight : tgaosohu. function name : search_by_ID Comments : 按工號(hào)查找所有員工信息記錄input :
50、160; 無(wú)output : 輸出查找員工編號(hào)CreatedDate : 2007/06/01*/int search_by_ID()
51、; /*查找模塊*/int i,k;struct worker s;k=-1;system( "cls" ); printf("nnEnter the ID:");scanf("%s",s.ID); /*輸入要到達(dá)的地方*/for(i=0;i<n;
52、i+) /*查找要修改的數(shù)據(jù)*/ if(strcmp(s.ID,woi.ID)=0) k=i;
53、 /*找到要修改的記錄*/ printf("nt工號(hào) 銀行卡號(hào) 職稱 年齡 性別 實(shí)發(fā)工資 手機(jī) 住宅n"); &
54、#160; printf_one(k); printf("工資信息:n"); printf("nt基本工資 實(shí)發(fā)工資 獎(jiǎng)金 電費(fèi) 清潔費(fèi) &
55、#160; 水費(fèi) 電視費(fèi) 稅金n"); printf_one_s(k); break;
56、 /*調(diào)用顯示一個(gè)記錄的函數(shù)*/ if(k=-1) printf("nnNO exist!"); getch();
57、; menu1(); return -1;else getch(); menu1(); return k;/*Author : GTCopyRight : tgaosoh
58、u. function name : search_by_age Comments : 按年齡查找所有員工信息記錄input : 無(wú)output &
59、#160; : 輸出查找員工編號(hào)CreatedDate : 2007/06/01*/int search_by_age() /*查找模塊*/in
60、t i,k,t_age,b_age;struct worker s;k=-1;system( "cls" ); printf("nnEnter the top age:");scanf("%d",&t_age); printf("nnEnter the bottom age:");scanf("%d",
61、&b_age); printf("nt工號(hào) 銀行卡號(hào) 職稱 年齡 性別 實(shí)發(fā)工資 手機(jī) 住宅n"); for(i=0;i<n;i+)
62、60; /*查找要修改的數(shù)據(jù)*/ if(woi.age>=b_age&&woi.age<=t_age) k=i; /*找到要修改的記錄*/
63、 printf_one(k); break; /*調(diào)用顯示一個(gè)記錄的函數(shù)*/ if(k=-1)&
64、#160; printf("nnNO exist!"); getch(); menu1(); return -1;else getch();
65、0; menu1(); return k;/*Author : GTCopyRight : tgaosohu. function name : search_by_P Comments
66、 : 按職稱統(tǒng)計(jì)所有員工的工資信息input : 無(wú)output : 無(wú)CreatedDate : 2007/06/01*/void count_by_P()
67、; /*查找模塊*/int i,k;float S_sal3=0,0,0,sal3=0,0,0,bon3=0,0,0,tax3=0,0,0; system( "cls" ); for(i=0;i<n;i+
68、) /*查找要修改的數(shù)據(jù)*/ if(woi.ID_P=1) S_sal0=S_sal0+woi.salary.S_wage; sal0=sal0+woi.salary.wage1;
69、; bon0=bon0+woi.salary.Bonus; tax0=tax0+woi.salary.tax; else if(woi.ID_P=2) S_sal1=S_sal1+woi.salary.S_wage; sal1=sal1+woi.salary.wage1;
70、 bon1=bon1+woi.salary.Bonus; tax1=tax1+woi.salary.tax; else if(woi.ID_P=3) S_sal2=S_sal2+woi.salary.S_wage; sal2=sal2+woi.salary.wage1; bon2=bon2+wo
71、i.salary.Bonus; tax2=tax2+woi.salary.tax; printf("n級(jí)別為高級(jí)工程師的工資統(tǒng)計(jì)為:n");printf("實(shí)發(fā)工資:%f,基本工資:%f,獎(jiǎng)金:%f,稅金:%fn",S_sal0,sal0,bon0,tax0);printf("n級(jí)別為中級(jí)工程師的工資統(tǒng)計(jì)為:n");printf("實(shí)發(fā)工資:%f,基本工資:%f,獎(jiǎng)金:%f,稅金:
72、%fn",S_sal1,sal1,bon1,tax1);printf("n級(jí)別為初級(jí)工程師的工資統(tǒng)計(jì)為:n");printf("實(shí)發(fā)工資:%f,基本工資:%f,獎(jiǎng)金:%f,稅金:%fn",S_sal2,sal2,bon2,tax2);printf("n公司所有人員的工資統(tǒng)計(jì)為:n");printf("實(shí)發(fā)工資:%f,基本工資:%f,獎(jiǎng)金:%f,稅金:%fn",S_sal2,sal2,bon2,tax2);getch(); menu1();/*Author
73、60; : GTCopyRight : tgaosohu. function name : order Comments : 按照實(shí)發(fā)工資的高低排序input :
74、; 無(wú)output : 無(wú)CreatedDate : 2007/06/01*/void order()
75、60; /*排序模塊(按平均成績(jī))*/int i,j,k;struct worker s;system( "cls" ); for(i=0;i<n-1;i+) /*選擇法排序*/ k=i; for(j=i+1;j<n;j+)
76、; if(woj.salary.S_wage>wok.salary.S_wage) k=j; s=woi; woi=wok; wok=s; printf("The ordered data is:n");browse();getch(); menu1();/*Author
77、160; : GTCopyRight : tgaosohu. function name : menu1 Comments : 員工管理操作的子菜單input :
78、; 無(wú)output : 無(wú)CreatedDate : 2007/06/01*/void menu1()int n,w1; do system( "
79、;cls" ); /*清屏*/ puts("tttt 員工管理操作!nn");
80、 puts("tt*MENU*nn"); puts("tttt1.search by ID"); puts("tttt2.search by age"); puts("tttt3.count salary&
81、quot;); puts("tttt4.order by salary"); puts("tttt5.return to menu"); puts("nntt*n");
82、 printf("Choice your number(1-5): bb"); scanf("%d",&n); if(n<0|n>5)
83、; /*對(duì)選擇的數(shù)字作判斷*/ w1=1;
84、160; printf("your choice is not between 1 and 4,Please input again:"); getchar();
85、0; else w1=0; while(w1=1);/*選擇功能*/switch(n) case 1:search_by_ID();break; /*輸入模塊*/ case 2:search_by_age();break;
86、60; /*瀏覽模塊*/ case 3:count_by_P();break; /*查找模塊*/ case 4:order();break; /*瀏覽模塊*/ case 5:menu(); /*Author
87、; : GTCopyRight : tgaosohu. function name : menu Comments : 員工管理系統(tǒng)主菜單input :
88、0; 無(wú)output : 無(wú)CreatedDate : 2007/06/01*/void menu()int n,w1; do system( "cls" );
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 農(nóng)村電商示范縣創(chuàng)建資金申請(qǐng)2025年農(nóng)村電商產(chǎn)品創(chuàng)新與研發(fā)報(bào)告
- 2025年餐飲企業(yè)突發(fā)事件應(yīng)急演練效果評(píng)估與反饋報(bào)告001
- 2025金融行業(yè)反欺詐技術(shù)挑戰(zhàn)與大數(shù)據(jù)解決方案深度報(bào)告
- 機(jī)柜10000個(gè)智算中心項(xiàng)目可行性研究報(bào)告模板-立項(xiàng)備案
- 培訓(xùn)課件溫馨提醒
- 花卉銷售培訓(xùn)課件
- 服務(wù)加班培訓(xùn)課件
- 廣安市中考模擬數(shù)學(xué)試卷
- 2025年主題公園沉浸式體驗(yàn)項(xiàng)目跨文化體驗(yàn)區(qū)開(kāi)發(fā)與市場(chǎng)策略報(bào)告
- 2025年主題公園沉浸式體驗(yàn)設(shè)計(jì)風(fēng)險(xiǎn)控制與項(xiàng)目開(kāi)發(fā)報(bào)告
- 滋補(bǔ)品店鋪運(yùn)營(yíng)方案設(shè)計(jì)
- 2025年保密教育線上培訓(xùn)考試題庫(kù)參考答案
- 安管員考試題庫(kù)及答案
- 《屹立在世界的東方》課件
- 【博觀研究院】中國(guó)口服維生素保健品市場(chǎng)分析報(bào)告(簡(jiǎn)版)
- T/CI 475-2024廚余垃圾廢水處理工程技術(shù)規(guī)范
- T/CCT 011-2020干法選煤技術(shù)規(guī)范
- (高清版)DB62∕T 4730-2023 公路裝配式石籠防護(hù)設(shè)計(jì)與施工技術(shù)規(guī)范
- 2024-2025 學(xué)年八年級(jí)英語(yǔ)下學(xué)期期末模擬卷 (深圳專用)原卷
- 內(nèi)蒙古呼和浩特市實(shí)驗(yàn)中學(xué)2024-2025學(xué)年下學(xué)期七年級(jí)數(shù)學(xué)試卷
- 2025年重癥醫(yī)學(xué)科ICU護(hù)理信息化建設(shè)計(jì)劃
評(píng)論
0/150
提交評(píng)論