C語言程序設計報告職工工資管理系統(tǒng)-_第1頁
C語言程序設計報告職工工資管理系統(tǒng)-_第2頁
C語言程序設計報告職工工資管理系統(tǒng)-_第3頁
C語言程序設計報告職工工資管理系統(tǒng)-_第4頁
C語言程序設計報告職工工資管理系統(tǒng)-_第5頁
免費預覽已結束,剩余24頁可下載查看

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、C語言程序設計報告課程名稱:C語言程序設計院系:管理與經濟學院專業(yè)班級:工業(yè)工程2012142班學號:201214217學生姓名:海蛟指導教師:雪青完成時間:2013-06-20報告成績:目錄1、設計題目22、設計要求(包括設計容描述)2的與目作、設計用33件所、用軟計統(tǒng)5、系設4構統(tǒng) 5.1系結4專業(yè)資料word5.2程序程序圖45.3產生源程序66、實驗調試結果(附運行效果圖)367、設計中的問題及解決方法398、設計心得9、參考文獻4041專業(yè)資料word職工工資管理系統(tǒng)的設計與實現(xiàn)1 設計題目題目:工資管理系統(tǒng)工資管理系統(tǒng)是企業(yè)不可缺少的部分,它利用計算機對員匸工資進行統(tǒng)管理,實現(xiàn)工資

2、管理 系統(tǒng)的系統(tǒng)化、規(guī)化和自動化,為企業(yè)捉高工作效率。本程序旨在訓練讀者的基本編程能力,了 解管理信息系統(tǒng)的開發(fā)流程,熟悉C語言的文件和結構數(shù)組的各種基本操作。本程序中涉及結 構體、數(shù)組、文件等方而的知識。2設計要求1啟動軟件時,進行密碼校驗。若出錯三次,則自動退出系統(tǒng)。2、實現(xiàn)簡易的提示菜單界面,剛運行時應顯示版本信息。用所學的知識盡量實現(xiàn)良好的、美觀的“人機界面”,便于軟件的操作使用。3、要求把所有錄入的數(shù)據(jù)以文件的形式,保存在硬盤上。4、系統(tǒng)包含以下基本功能:登陸功能、顯示主菜單功能、職工信息輸入信息輸出、職工信息査 詢、職工信息修改、工資排序、工資統(tǒng)計、導出數(shù)據(jù)、導入數(shù)據(jù)、退出等。5、

3、職工信息輸入信息輸出要求個職工的基本信息(編號、姓名、基本匸資)的錄入,以文件形 式保存一一輸入。6、職工工資農瀏覽工資功能一一輸出。7、計算職工的工資(輸入基本工資、扣款、獎金后,馬上算出應發(fā)工資、稅金、實發(fā)工資、總 工資)。8、査詢、排序功能一一算法。1)按編號查詢、排序。2)按姓名查詢。專業(yè)資料word3)按工資排序。4)基本信息的刪除與修改(可選項)。3 設計作用與目的1通過這次專題實習,鞏固和加深對所學相關知識點的理解。2、進一步熟悉基本流程控制結構實現(xiàn)分支的ifelse語句、switch語句和實現(xiàn)循環(huán)的for、while、dowhile語句、break、continue等。3、基本

4、數(shù)據(jù)類型、數(shù)組、結構體、自定義類、函數(shù)的應用。4、加強對模塊化程序設計和面向對象程序設計的理解。5、掌握C語言程序設計的基本思想,了解簡單的系統(tǒng)分析和6、了解數(shù)據(jù)庫系統(tǒng)的理論7、掌握數(shù)據(jù)庫設計的基本方法,熟悉數(shù)據(jù)庫設計的步驟;8、學習基本數(shù)據(jù)庫編程方法。9、進一步鞏固、加深學生所學專業(yè)課程C語言程序設計的基本理論知識,理論聯(lián)系實際,進一步培養(yǎng)學生綜合分析問題,解決問題的能力。10全面考核學生所掌握的基本理論知識及其實際業(yè)務能力,從而達到提高學生 素質的最終LI的。11利用所學知識,開發(fā)小型應用系統(tǒng),掌握運用c語言編寫調試應用系統(tǒng)程序,訓練獨立開發(fā)應用系統(tǒng),進行數(shù)據(jù)處理的綜合能力。12對于給定的

5、設訃題LI,如何進行分析,理清思路,并給出相應的數(shù)學模型。13掌握面向對象的程序設訃方法。14進一步掌握在集成環(huán)境下如何調試程序(單步調試,設置斷點、觀察表達式, 分塊調試)、專業(yè)資料word修改程序和程序的測試。4運行環(huán)境及工具軟件Windows XP;Visual C+ 6.0 (完整綠色版);5 系統(tǒng)設計:系統(tǒng)結構框圖圖5.1程序邏輯圖職工工資管理系統(tǒng)登陸功能用戶 管理職工信息輸入職工 信息 輸出詢職 工工 資信 息查職工 信息 修改工資 排序導出數(shù)據(jù)1:資 統(tǒng)計工資 計算退導出入數(shù) 據(jù)1專業(yè)資料word5.2程序流程圖開始系統(tǒng)登錄主頁面選擇操作選擇選擇選擇123初始化雙鏈農錄入職工工資

6、修改職工工資查詢職工工資專業(yè)資料word瀏覽職工工資4選擇刪除職工工資5選擇刪插入職工工資6選擇職工工資排席7選擇保存職工工資8選擇9選擇結束按編號刪除6源程序代碼安全退出系統(tǒng)#include <stdio . h> /標準輸入輸Hl 處理雜亂#include<stdlib h> /#include <windows h> /Sleep ()字符串操作#include <string. h> /系統(tǒng)輸入輸出#include <conio . h> /時間 相關#include <time.h> /*/ 下血是對用到的全局常

7、量 聲明宀mmm職工職匸姓名長度#define NAME 10 /專業(yè)資料word#define PASSWORD S /系統(tǒng)登陸密碼 int shuru=0; /全局變量標記當前錄入職:個數(shù)FILE *fp; /聲明個文件指針結構體定義struct person /職工工資的結構體char name NAME ; /職匸職工姓名int num; /職 L編號float paid; /職工基本工資float discount; /扌D款float extra; /獎金float farm;/稅金float gotpaid; /應發(fā)工資float realpaid; /實發(fā)工資float sum

8、; /總:資*pp; /聲明i個結構指針/A-* I下面是對用到的函數(shù)聲明 void Password () ; /密碼驗證函數(shù)void Save (struct person per ) ; /保存信息函數(shù) void Inputper (struct person per ) ; /錄入信,息、函數(shù) void Delper (struct person per ) ; /刪除信息函數(shù) void Modifyper (struct person per ) ; /修改信息函數(shù) void Findper (struct person per ) ; /查找信息函數(shù) void Insertper

9、(struct person per ) ; /插入彳言,息函數(shù) void Sortper (struct person per ) ; /扌IF 序函數(shù) void Listper (struct person per ) ; /顯刀M只:信息 void fare (struct person per , int n);/計算稅金函數(shù) void Menu();void Help();void main () /程序入口system (color 027) ; /設置當前窗口的背景色和前景色Password (); /調用密碼驗函數(shù)Help(); /調用系統(tǒng)信息函數(shù)Menu(); /調用菜單函數(shù)

10、void Inputper (struct person per ) /錄入職工工資函數(shù)原形pp=per; /指針指向結構system (cis) ; /清屏int i;軸潼晴龍請問你要輸入幾個職工的信息:);scanf(%d,&shuru);if ( (fp=fopen (inputdata, wb+) ) =NULL) /當前目錄下是否存在 INPUTDATA 文件 專業(yè)資料word /wb+:讀寫打開或建立-個二進制文件,允許讀和寫printf(Cannot open file strike any key exit!);getch();exit(l);濟械磔?瀬尬職工編號職工姓

11、名基本匸資扣款獎金應發(fā)工資稅金實發(fā)匚作總工資n); for (i=0;i<shuru;i+)抽潼晴龍輸入職工編號:);/輸入職工編號fflush(stdin);scanf(%d,&per i num);抽潼晴龍輸入職工姓名:);/輸入職工姓名fflush(stdin);gets(per i name);抽潼晴龍輸入職工的工資信息n);printf (n);printf(基本工資:);/基本一匸資fflush(stdin);scanf(%f,&per ipaid);printf(扣款:);/扣款fflush(stdin);scanf(%f,&per i discou

12、nt);printf(獎金:);/獎金fflush(stdin);scanf(%f,&per iextra);printf(稅金:);/稅金printf (n);perisum=peripaid-peridisooun匕+pm工iextra;peri .realpaid=peripaid-peridiscount;fprintf(fp,m %8s %5Ift %5Ift %3Ift %5Ift Iftn,perinum,perinam e,peripaid,peridiscount,periextra,peri.realpaid,peri.sum );void Modifyper(st

13、ruct person per ) pp=per;int id,i=0; /id為接收用戶輸入的職工編號if(fp=fopen(modifydata sys,wb+)=NULL)printf (Cannot open file strike any key exit!); getch ();exit(1);專業(yè)資料word濟械磔?瀕尬職工編號職工姓名基本工資扣款獎金應發(fā)工資稅金實發(fā)匚資總工資n); printf(請輸入你要修改的職工的編號:);scanf(%dz &id);Sleep (500);printf(t査找相關數(shù)據(jù).);for (i=0;i<=15;i+)Sleep (

14、250);printf();for (i=0;i<shuru;i+)if (per i .num=id) /如果找到了就執(zhí)行下而語句,找不到直接回主界而printf(輸入新職工編號:);/輸入職工編號fflush(stdin);scanf(%d,&per i num);printf(輸入新職工姓名:);/輸入職工姓名fflush(stdin);gets(per i name);抽潼晴龍輸入職匸的工資信息n);printf (n);printf(基本工資:scanf (%f,&peripaid);fflush(stdin);printf(扣款:scanf(%f,&p

15、eri discount);fflush(stdin);printf(獎金:);scanf(%f,&periextra);printf (n);perisum=peripaid-peridisooun匕+pm工iextra;perirealpaid=peripaid-peridiscount;fprintf(fp,m %8s %51ft %51ft %31ft %51ft %41ftnz peri rmm,pErinam e,peripaid,peridiscount,periextra,perirealpaid,perisum );void Findper (struct perso

16、n per ) /查詢職工工資信息int i=O,j=O,id; /循環(huán)變雖和用于接收職工編號專業(yè)資料word抽潼晴龍請輸入你要査詢的職工編號:);scanf(%d,&id);for (i=0;i<shuru;i+)if (per i .num=id) /如果找到你査詢的數(shù)據(jù)就執(zhí)行下而語句 /如果找不到。直接回程序主界毛perisum=peripaid-peridiscount+periextra;perirealpaid=peripaid-peridiscount;printf(職工編號職工姓名基本工資扣款獎金應發(fā)工資稅金實發(fā)工資總工資n);printf(m %8s %5lft

17、 %5lft %3lft %5lft %5lft %5lft $4lftnn,perinum,periname,peripaid,peridisoount,pm工iextra,peri gotpaid,peri fare,peri realpaid,peri sum); system(pause);void Insertper (struct person per ) /插入I只二匸資信息int flag=l;pp=per;int iz id;if ( (fp=fopen(insertdata sys,wb+)=NULL)printf(Cannot open file strike any k

18、ey exit!);getch();exit(l);濟械磔?瀬尬職工編號職工姓名基本匸資扣款獎金應發(fā)工資稅金實發(fā)匚資總工資n); 軸潼晴龍輸入你插入的職工編號:);scanf(%d,&id);for (i=0;i<shuru;i+)if (per i . num=id) /判斷職工編號信息否存在?抽潼晴龍職工編號信息已經存在!n);flag=0;getch ();break;if (flag!=0)shuru+; /插入個,原來的總數(shù)增加1專業(yè)資料word抽潼晴龍請確認輸入要插入職工編號:);scanf (%dz &per shuru-1 .num) ; /如果不存在那么

19、就把插入的信息放到結構數(shù)組最后 抽潼晴龍輸入職工姓名:);fflush(stdin);gets(pershuru-1name);抽潼晴龍輸入職匸的工資信息n);printf (n);printf(基本工資:);fflush(stdin);scanf (%f,&pershuru-1paid);printf(扣款:fflush(stdin);scanf(%f,&pershuru-1 discount);printf(獎金:);/獎金fflush(stdin);printf(稅金:);/稅金fflush(stdin);printf (n);perisum=peripaid-perid

20、iscount+periextra;peri .realpaid=peripaid-peridiscount;fprintf(fp,m %8s %5Ift %5Ift $3Ift %5Ift Iftnzpershuru-1num,per shuru-1name,pershuru-1paid,pershuru-1discount,pershuru-1ex tra,peri realpaid,pershuru-1 sum);Sleep (500);抽潼晴龍插入數(shù)據(jù)成功!n);getch ();void Listper (struct person per ) /瀏覽所有職工工int i=0;for

21、 (i=0;i<shuru;i+) per igotpaid=peripaid-peridiscount;if (perigotpaidv2000)per i fare=0;else if (perigotpaid>=2000&&perigotpaid<4999)per ifare=perigotpaid*005;else if (per igotpaid>=5000&&perigotpaid<10000)per ifare=peri gotpaid*0l;else if (per igotpaid>=l0000&&a

22、mp;perigper ifare=perigotpaid*025;else if (per igotpaid>=l00000)per ifare=perigotpaid*03;專業(yè)資料wordperi.sum=peripaid-peridiscount+periextra; perirealpaid=peripaid-peridiscount;printf(職工編號職工姓名基本工資扣款獎金應發(fā)工資稅金實發(fā)工資總工資n);for (i=0;i<shuru;i+)printf(m %8s %5lft %5lft %3lft %5lft %5lft %4lft %5lft,peri n

23、um,periname,peripaid,peridiscount,periextra,per igotpa id,perifare,perirealpaid,peri sum);getch();void Delper (struct person per ) /刪除職工信息函數(shù)pp=per;struct person temp;int delnum;char ask;int iz j;if ( (fp=fopen(Deldata sys,wb+)=NULL)printf (Cannot open file strike any key exit!);getch();exit(l);濟械磔?瀕

24、尬職工編號職工姓名基本工資扣款獎金應發(fā)工資稅金實發(fā)匚資總工資n); system(cis);printf(nt請輸入你耍刪除的職工的職工編號:);fflush(stdin);scanf(%d,&delnum);printf(匕是否確認刪除職Id的信息(y/n) z delnum);fflush(stdin);ask = getchar ();if(ask != 'nf)for(i=0;i<shuru;i+) if(perinum = delnum) break;if (i > shuru)printf(t沒有你要刪除的職X!n);else專業(yè)資料wordfor (j

25、 =i;j<shuru;j +)temp = perj;per j = perj+1;per j +1 = temp;shuru; /刪掉個職工信息后職1:總數(shù)相應7system(cis);printf(n刪除成功! n);perisum=peripaid-peridisoount+pm工iextra;perirealpaid=peripaid-peridiscount;fprintf (fp, m %8s t%5lf t%5lf t%5lf t%5lft%41fn,perinum,periname,peripaid,peridiscount,peri e xtra,peri realp

26、aid,peri sum);getch();void Sortper (struct person per ) /扌豐序函數(shù)int i, j , chose; /i, j為循環(huán)變量chose為接收用戶輸入的排丿字方式struct person temp;抽潼晴龍扌II:序前的數(shù)據(jù)為n);printf(職工編號職工姓名基本工資扣款獎金應發(fā)工資稅金實發(fā)工資總工資n);for (i=0;i<shuru;i+)printf(m %8s %5Ift %5Ift %3Ift %5Ift Iftn,perinum,perinam e,peripaid,peridiscount,periextra,pe

27、ri.realpaid,peri.sum );printf(1.按職工編號排序t2.按總工資(高低)排序n> ;printf(請您正確選擇:);fflush(stdin);scanf(%dz &ohose);if(chose=l)for(i=0;i<shuru-l;i+)for(j =i + l;j <shuru;j +)if(peri num>perj num)temp=peri;per i=perj;專業(yè)資料wordperj=temp;printf(職工編號職工姓名基本工資扣款獎金應發(fā)工資稅金實發(fā)工資總工資n);for (i=0;i<shuru;i+)

28、printf(namsumm %8s %51ft %51ft %31ft %51ft 1ftn,perinu工i ez peripaid,peridiscount,periextra,per irealpaid,peri );system(pause);else if (chose=2)for (i=0;i<shuru-l;i+)for(j =i + l;j <shuru;j +) if (peri sum<perj sum) temp=per i;peri=per j;perj=temp;printf(職工編號職工姓名基本工資扣款獎金應發(fā)工資稅金實發(fā)工資總工資n);for

29、(i=0;i<shuru;i+)printf(m %8s %51ft %51ft %31ft %51ft %41fn,perinum,periname, peripaid,peri discount,peri extra,peri realpaid,peri sum); system(pause);void Passwordf) /密碼驗證函數(shù)char *pass=NULL; /初始化指針int i,count;start, end; /時I、可函數(shù)pass= (char *) malloc (255*sizeof (char) ) ; /分配存while(1)count=0;專業(yè)資料w

30、ordprintf(nnnnttt職I】匸資管 理系統(tǒng)n);printf(tt Use 工 Namm:海蛟 n);printf(tt Password:);while ( (count>=0) && (pass count+ =getch () ) ! =13) /客】碼車俞入 if (pass0=fbf)count=0;continue;else if (passcount-1= *b *)printf(%c%c%cz *b1, f01z 1b1);count-=2;elseputchar(1 * 1);passcount = *01 ;if ( ! strcmp (p

31、ass, PASSWORD) ) /開女臺驗證printf(nttttttLogining);for (i=0;i<=25;i+)Sleep(250);printf();system(cis);printf(nnnnnnnnttt);printf (歡迎登陸職工工資管理系統(tǒng)!nn); start=time(NULL);end=time(NULL);while (end-start<2) /延時2秒執(zhí)行以卜程序end=time(NULL);system(cis);free (pass); /釋放儲存密碼的存return ;free (pass); /釋放密碼錯謀的那塊存pass= (

32、char *) malloc (255*sizeof (char) ) ; /重新分配儲存密碼存 system(cis);printf(annnnnnnntttt 密碼錯誤!);專業(yè)資料wordgetch (); system(cis); void Menu()struct person per 50 ; /最大職工人數(shù) struct person *p; /聲明-個結構指針 p=per; /指針指向結構變S per int izin; /接收用戶的選擇 char ch; /用于判斷是否繼續(xù)system(cis);printf(printf( t =n) printf ( t*職匸匚資管理系統(tǒng)

33、*n);printf ( t *=*n) if ( ! (scanf(%d,&in)=l) while(ch=getchar() ! = *n1) putchar(ch);printf( t * printf( t printf( t * printf( t printf( t * printf( t printf( t * printf( t printf( t * printf( t printf( t * printf( t printf( t * printf( t printf( t * printf( t printf( t *1.錄入職工工資*n)2 修改職工工資3. 査

34、詢職工工資4. 瀏覽職工工資5. 刪除職工工資6插入職工工資7. 職工工資排序8. 保存職工工資9. 安全退出系統(tǒng)printf( t=n)printf(t請您正確選擇:printf (沒有此選項,請正確選擇!); getch ();continue;專業(yè)資料wordfflush(stdin);switch(in)case 1:Inputper (per) ; /調用錄入職工工資函數(shù) break;case 2 :Modifyper(per); /調用修改職工工資函函數(shù) break;case 3:Findper(per); /調用查詢職工工資函數(shù) break;case 4:Listper(per)

35、; /調用瀏覽職工工資函數(shù) break;case 5:Delper(per); /調用刪除職工工資函數(shù) break;case 6:Insertper (per) ; /插入職工工資信息 break;case 7 :Sortper (per) ; /調用職工工資扌非序函數(shù) break;case 8:Save (per); /保存職工工資函數(shù)break;case 9 : /退出系統(tǒng)break;default:抽潼晴龍沒有此選項,請正確選擇!);getch ();break;while(in!=9);system(cis);printf (nnnnnnnttt);抽潼晴龍謝謝使用本系統(tǒng)!nn); p

36、rintf(ntttttEnding);for (i=0;i<=30;i+)Sleep (300); printf();專業(yè)資料wordprintf();void Help ()printf(printf(ntttt 系統(tǒng)信息“);printf(=n);printf(ntt本系統(tǒng)是職工工資管理系統(tǒng),在職工的姓名欄可以輸入漢字);printf(tt如果在輸入中沒看到任何信息則是因為輸入錯謀或無信息);printf(tt系統(tǒng)中的:實發(fā)工資=基本工資-扣款,不需要輸入); printf(tt實發(fā)工資,就可以直接輸出實發(fā)工資,系統(tǒng)中的:);printf(tt總工資=基本工資-扣款+獎金。prin

37、tf(七七本系統(tǒng)制作者:海蛟t QQ : 253181150);printf(tt E-mail : 253181150qq);printf(ttt Made By VC6 0+匕 2013 年 6 月 18 I3n);printf(二=二=n);printf (ntttt 按Enter進入);getchar();void Save (struct person per ) /】只匸IE資保存函數(shù)int i,j;pp=per; /指針指向結構system(cis);printf(nntt正在保存信息,請耐心等候! ! n);printf(ntttSaving);for(j=0;j<20;

38、j+)Sleep (300);printf();if(fp=fopen(per_list2 doc,wb+)=NULL)printf (Cannot open file strike any key exit!);getch ();exit(1);濟械鎳?瀬尬職工編號職工姓名基本工資扣款獎金應發(fā)工資稅金實發(fā)工資總工資n);for (i=0;i<shuru;i+) perigotpaid=peripaid-peridiscount;if (perigotpaid<2000)peri fare=0;else if (per igotpaid>=2000&&peri

39、gotpaid<4999)專業(yè)資料wordper ifare=perigotpaid*005;else if (perigotpaid>=5000&&perigotpaid<10000)per ifare=peri gotpaid*0l;else if (perigotpaid>=10000&&perigotpaid<99999)per ifare=perigotpaid*025;else if (per igotpaid>=100000)per ifare=perigotpaid*03;perisum=peripaid-peridiscount+periextra;perirealpaid=peripaid-peridiscount;fprintf(fp,m %8s %5.1ft %5.1ft %3.1ft %5.1ft %5.1ft%5.Ift,per i.num,periname,peripaid,p

溫馨提示

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

評論

0/150

提交評論