《員工工資管理系統(tǒng)(c語言編程).docx》由會員分享,可在線閱讀,更多相關(guān)《員工工資管理系統(tǒng)(c語言編程).docx(6頁珍藏版)》請在裝配圖網(wǎng)上搜索。
1、#include #include#include#include#define null 0typedef struct Info1char num10;char name10;char depar10;char yfsalary10;char aband10;char tax10;char sfsalary10;struct Info1 *next;Info2;typedef struct Info1 *Info;Info head;void display();void find();void modify();void add();void del();void list();void
2、 listOne(Info s);Info isExists(char *num);void init();void init()head=(Info)malloc(sizeof(Info2);head-next=null;void main()init();while(1)char c;display();scanf(%c,&c);switch(c) case 1:find();break; case 2:add();break;case 3:modify();break;case 4:del();break;case 5:list();break;case 6:printf(tt.退出系統(tǒng)
3、!n);return;default: printf(tt輸入錯誤!請按任意鍵返回重新選擇(1-7)n);getchar();void display()printf(nt* 歡迎使用員工信息管理系統(tǒng) *nn);printf(t請選(1-7):n);printf(t=n);printf(tt1.查詢員工信息n);printf(tt2.錄入員工信息n);printf(tt3.修改員工信息n);printf(tt4.刪除員工信息n);printf(tt6.顯示所有員工信息n);printf(tt7.退出系統(tǒng)n);printf(t=n);printf(t您的選擇是: );void listOne(I
4、nfo p)printf(n該員工信息記錄如下: );printf(n=nn);printf(%-12s%-10s%-10s%-7s%-7s%-10s%-10s%n,員工編號,姓名,部門,應(yīng)付工資,保險,稅金,實付工資);printf(%-12s%-10s%-10s%-7s%-7s%-10s%-10s%n,p-num,p-name,p-depar,p-yfsalary,p-aband,p-tax,p-sfsalary);Info isExists(char *num)Info p,q;p=head;q=p-next;while(q!=null)if(strcmp(q-num,num)=0)re
5、turn p;p=q;q=p-next;return p;void add()Info p,q;char num10;q=(Info)malloc(sizeof(Info2);printf(tt請輸入員工編號: );scanf(%s,num);p=isExists(num);if (p-next=null)strcpy(q-num,num);printf(tt請輸入員工姓名: );scanf(%s,q-name);printf(tt請輸入該員工的部門: );scanf(%s,q-depar);printf(tt請輸入該員工的應(yīng)付工資金額: );scanf(%s, q-yfsalary);pri
6、ntf(tt請輸入該員工的保險金額: );scanf(%s, q-aband);printf(tt請輸入該員工的稅金金額: );scanf(%s,q-tax);printf(tt請輸入該員工的實付工資: );scanf(%s,q-sfsalary);q-next=null;p-next=q;elseprintf(ntt您所輸入的員工編號以存在! );printf(ntt按任意鍵返回住菜單.);getchar();void del()Info p,q;char num10;if (head-next=null)printf(ntt當(dāng)前還沒有員工信息記錄,按任意鍵返回主菜單.);getchar()
7、;return;printf(tt請輸入員工編號: );scanf(%s,num);p=isExists(num);q=p-next;if (q!=null)q=q-next;p-next=q;printf(ntt刪除成功! );elseprintf(ntt您所輸入的員工編號有誤或不存在! );printf(ntt按任意鍵返回主菜單.);getchar();void modify()Info p,q;char num10;if (head-next=null)printf(ntt當(dāng)前還沒有員工信息記錄,按任意鍵返回主菜單.);getchar();return;printf(tt請輸入員工編號:
8、 );scanf(%s,num);p=isExists(num);q=p-next;if(q!=null)listOne(q);printf(tt請輸入該員工的新姓名: );scanf(%s,q-name);printf(tt請輸入該員工的部門: );scanf(%s,q-depar);printf(tt請輸入該員工的應(yīng)付工資金額: );scanf(%s,q-yfsalary);printf(tt請輸入該員工的保險: );scanf(%s,q-aband);printf(tt請輸入該員工的新稅金金額: );scanf(%s,q-tax);printf(tt請輸入該員工的新實付工資: );sca
9、nf(%s,q-sfsalary);elseprintf(ntt您所輸入的員工編號有誤或不存在!);printf(ntt按任意鍵返回主菜單.);getchar();void list()Info p;if (head-next=null)printf(ntt當(dāng)前還沒有員工信息記錄,按任意鍵返回主菜單.);getchar();return;printf(n所有員工信息記錄如下: );printf(n=nn);printf(%-12s%-10s%-10s%-7s%-7s%-10s%-10s%n,員工編號,姓名,部門,應(yīng)付工資,保險,稅金,實付金額);p=head-next;while(p!=nul
10、l)printf(%-12s%-10s%-10s%-7s%-7s%-10s%-10s%n,p-num,p-name,p-depar,p-yfsalary,p-aband,p-tax,p-sfsalary);p=p-next;printf(ntt按任意鍵返回主菜單.);getchar();void find()Info p;char num10;if (head-next=null)printf(ntt當(dāng)前還沒有員工信息記錄,按任意鍵返回主菜單.);getchar();return;printf(tt輸入員工編號: );scanf(%s,num);p=isExists(num);p=p-next;if(p!=null)listOne(p);elseprintf(ntt您所輸入的員工信息有誤或不存在!);printf(ntt按任意鍵返回主菜單.);getchar();