c語言員工工資管理系統
『壹』 c語言 工資管理系統
這個要靠調試了,不過有時候調試可能還不如重寫快,可以幫寫
『貳』 c語言編一個工資管理系統 本系統能夠方便、靈活地實現職工工資的輸入、添加、刪除等編輯操作以及查詢等
*/#include "stdafx.h"
#include "iostream"
#include "string"
#include "list"
#include "cassert"
using namespace std;/*
編號、姓名、部門、應付工資、保險、稅金、實付工資。
其中實付工資由公式計算得到:實付工資=應付工資 - 保險- 稅金
*/
struct employee{
string m_num;//編號
string m_name;//姓名
string m_dep;//部門
double m_salary;//應付工資
double m_insurance;//保險
double m_tax;//稅金
};/*
(1)錄入:輸入職工數據,其中「實付工資」通過計算得到;
(2)刪除:刪除指定的職工信息(輸入姓名,若找到則刪除該信息)
(3) 修改:允許對已經錄入的數據重新進行編輯、修改;
(4) 顯示:顯示全體職工數據;
(5)查詢:
a. 輸入職工姓名,顯示該職工的全部數據;
b. 輸入某部門值,顯示該部門職工的數據、工資總額、平均工資。
(6) 退出程序。
*/list<employee> emps;int _tmain(int argc, _TCHAR* argv[])
{
void print(const employee &e);
void input();
void del();
void mod();
void show_all();
void show_name();
void show_dep();cout<<"簡易職工薪水管理程序 by 做他\n";// delete this line
cout<<"版權沒有 請隨意復制或修改任何代碼\n";//delete this linecout<<"請選擇操作:1.錄入 2.刪除 3.修改 4.查詢 5.顯示所有員工 6.退出 :";
int choose=0;
cin>>choose;
assert(!cin.fail());
while (choose!=6)
{
if (choose==1) input();
if (choose==2) del();
if (choose==3) mod();
if (choose==4)
{
int choice=0;
cout<<"請選擇操作 1.按姓名查詢 2.按部門查詢 3.退出:";
cin>>choice;
if (choice==1) show_name();
if (choice==2) show_dep();
if (choice==3)
{
cout<<"請選擇操作:1.錄入 2.刪除 3.修改 4.查詢 5.顯示所有員工 6.退出 :";
cin>>choose;
assert(!cin.fail());
continue;
}
}
if (choose==5) show_all();
cout<<"請選擇操作:1.錄入 2.刪除 3.修改 4.查詢 5.顯示所有員工 6.退出 :";
cin>>choose;
assert(!cin.fail());
}
return 0;
}void print(const employee &e)
{
cout<<"編號:"<<e.m_num<<endl;
cout<<"姓名:"<<e.m_name<<endl;
cout<<"部門:"<<e.m_dep<<endl;
cout<<"保險:"<<e.m_insurance<<endl;
cout<<"稅金:"<<e.m_tax<<endl;
cout<<"應付工資:"<<e.m_salary<<endl;
cout<<"實付工資:"<<e.m_salary-e.m_insurance-e.m_tax<<endl;
}void input()
{
string num,name,dep;
double salary,ins,tax;
cout<<"請輸入員工編號:";
cin>>num;
cout<<"請輸入員工姓名:";
cin>>name;
cout<<"請輸入員工部門:";
cin>>dep;
cout<<"請輸入員工保險:";
cin>>ins;
assert(!cin.fail());
cout<<"請輸入員工稅金:";
cin>>tax;
assert(!cin.fail());
cout<<"請輸入員工應付工資:";
cin>>salary;
assert(!cin.fail());
employee temp;
temp.m_dep=dep;
temp.m_insurance=ins;
temp.m_name=name;
temp.m_num=num;
temp.m_salary=salary;
temp.m_tax=tax;
emps.push_back(temp);
cout<<"員工錄入操作完畢.\n";
}void del()
{
if (emps.size()==0)
{
cout<<"沒有員工記錄.\n";
return;
}
string name;
bool isfind=false;
cout<<"請輸入要刪除的員工姓名:";
cin>>name;
list<employee>::iterator iter;
for (iter=emps.begin();iter!=emps.end();iter++)
{
if (iter->m_name==name)
{
isfind=true;
emps.erase(iter);
cout<<"姓名為\""<<name<<"\"的員工記錄已刪除.\n";
return;
}
}
if (!isfind)
{
cout<<"沒有找到姓名為\""<<name<<"\"的員工.\n";
return;
}
}void mod()
{
if (emps.size()==0)
{
cout<<"員工記錄為空.\n";
return;
}
bool isfind=false;
string name;
cout<<"請輸入要修改的員工姓名:";
cin>>name;
list<employee>::iterator iter;
for (iter=emps.begin();iter!=emps.end();iter++)
{
if (iter->m_name==name)
{
isfind=true;
cout<<"姓名為\""<<name<<"\"的員工記錄已找到.\n";
break;
}
}
if (isfind)
{
string num,name,dep;
double tax,ins,salary;
print(*iter);
cout<<endl;
cout<<"請輸入新的員工編號:";
cin>>num;
cout<<"請輸入新的員工姓名:";
cin>>name;
cout<<"請輸入新的員工部門:";
cin>>dep;
cout<<"請輸入新的員工保險:";
cin>>ins;
assert(!cin.fail());
cout<<"請輸入新的員工稅金:";
cin>>tax;
assert(!cin.fail());
cout<<"請輸入新的員工工資:";
cin>>salary;
assert(!cin.fail());
iter->m_dep=dep;
iter->m_insurance=ins;
iter->m_name=name;
iter->m_num=num;
iter->m_salary=salary;
iter->m_tax=tax;
cout<<"1 員工記錄被成功修改.\n";
}
else
{
cout<<"沒有找到姓名為\""<<name<<"\"的員工記錄.\n";
}
}void show_all()
{
if (emps.size()==0)
{
cout<<"員工記錄為空.\n";
return;
}
cout<<"顯示全體員工數據:\n";
cout<<"--------------------\n";
list<employee>::iterator iter;
for(iter=emps.begin();iter!=emps.end();iter++)
{
cout<<endl;
print(*iter);
cout<<endl;
}
cout<<"--------------------\n";
}void show_name()
{
if (emps.size()==0)
{
cout<<"員工記錄為空.\n";
return;
}
bool isfind=false;
string name;
cout<<"請輸入要查詢的員工姓名:";
cin>>name;
list<employee>::iterator iter;
for(iter=emps.begin();iter!=emps.end();iter++)
{
if (iter->m_name==name)
{
isfind=true;
cout<<"姓名為\""<<name<<"\"的員工記錄已找到.\n";
print(*iter);
break;
}
}
if (!isfind)
{
cout<<"沒有找到姓名為\""<<name<<"\"的員工.\n";
return;
}
}void show_dep()
{
if (emps.size()==0)
{
cout<<"員工記錄為空.\n";
return;
}
double isfind=0.00;
double total_salary=0.00;
string dep;
cout<<"請輸入要查詢的部門名稱:";
cin>>dep;
cout<<"部門["<<dep<<"]的員工信息:\n";
cout<<"--------------------\n\n";
list<employee>::iterator iter;
for(iter=emps.begin();iter!=emps.end();iter++)
{
if (iter->m_dep==dep)
{
isfind++;
total_salary+=iter->m_salary;
print(*iter);
cout<<endl;
continue;
}
}
cout<<"--------------------\n";
if (isfind==0)
{
cout<<"沒有找到名稱為["<<dep<<"]的部門.\n";
}
else
{
cout<<"部門["<<dep<<"]工資統計:\n";
cout<<"工資總額:"<<total_salary<<endl;
cout<<"平均工資:"<<total_salary/isfind<<endl;
}
}
『叄』 c語言 職工工資管理系統
怎麼沒有人回答
http://www..com/s?lm=0&si=&rn=10&tn=bdpage_pg&ie=gb2312&ct=0&wd=%D6%B0%B9%A4%B9%A4%D7%CA%B9%DC%C0%ED%CF%B5%CD%B3&pn=10&ver=0&cl=3&uim=1&usm=0
『肆』 如何用C語言編寫一個員工工資管理系統
哥們,這可是一個系統,你才給10分,敲代碼都得敲幾個月,10萬塊差不多,應該有人接外單,發給我的話我會接。
建議你直接去買個吧,約10-20萬
『伍』 c語言程序設計、工資管理系統
#include <stdio.h>
#include <malloc.h>
#include <string.h>
typedef struct
{
char num[10];
char name[20];
char date[15];
double pay;
}employee;
typedef struct node
{
employee p;
struct node *pre;
struct node *next;
}node,*linklist;
linklist head,last;
void setData(linklist p)
{
printf("編號:");
scanf("%s",&p->p.num);
printf("姓名:");
scanf("%s",&p->p.name);
printf("入職時間:");
scanf("%s",&p->p.date);
printf("工資:");
scanf("%lf",&p->p.pay);
}
void Insert(linklist p)
{
setData(p);
p->next=last;
last->pre->next=p;
p->pre=last->pre;
last->pre=p;
}
void Add()
{
char ch;
do
{
linklist p=(linklist)malloc(sizeof(node));
system("cls");
Insert(p);
printf("是否繼續?");
scanf(" %c",&ch);
}while(ch=='y'||ch=='Y');
}
linklist Qur(int method)
{
char ch[20];
linklist p=head->next;
if(method==0)
{
printf("選擇查詢方式:(1 姓名、2 年月)");
scanf("%d",&method);
}
if(method==1)
{
printf("輸入姓名:");
scanf("%s",ch);
while(p!=last)
{
if(strcmp(ch,p->p.name)==0) break;
p=p->next;
}
}
else if(method==2)
{
printf("輸入年月:");
scanf("%s",ch);
while(p!=last)
{
if(strcmp(ch,p->p.date)==0) break;
p=p->next;
}
}
if(p==last) {printf("未找到\n");system("pause");}
return p;
}
void Del()
{
linklist p=Qur(1);
if(p==last) return;
p->pre->next=p->next;
p->next->pre=p->pre;
free(p);
printf("刪除成功\n");
system("pause");
}
void Modify()
{
linklist p=Qur(1);
if(p==last) return ;
setData(p);
}
void printTitle()
{
printf("編號\t名稱\t入職日期\t工資\n");
}
void show(linklist p)
{
printf("%s\t%s\t%s\t%.2lf\n",p->p.num,p->p.name,p->p.date,p->p.pay);
}
void Sort()
{
linklist p,q;
for (p=head->next;p!=last;p=p->next)
{
for (q=p->next;q!=last;q=q->next)
{
if(p->p.pay<q->p.pay)
{
employee temp=p->p;
p->p=q->p;
q->p=temp;
}
}
}
printf("完成\n");
system("pause");
}
void Tongji()
{
linklist p=head->next;
Sort();
printTitle();
while(p!=last)
{
show(p);
p=p->next;
}
system("pause");
}
void Wrong()
{
printf("輸入錯誤!\n");
system("pause");
}
void menu(void)
{
system("cls");
printf("********工資管理系統*******\n");
printf("* *\n");
printf("* 1:添加 *\n");
printf("* 2:刪除 *\n");
printf("* 3:查詢 *\n");
printf("* 4:修改 *\n");
printf("* 5:統計 *\n");
printf("* 6:排序 *\n");
printf("* 0:退出 *\n");
printf("* *\n");
printf("*******************************\n");
}
int select()
{
int choose;
scanf("%d",&choose);
switch(choose)
{
case 1:Add();break;
case 2:Del();break;
case 3:
{
linklist p=Qur(0);
if(p!=last) {show(p);system("pause");}break;
}
case 4:Modify();break;
case 5:Tongji();break;
case 6:Sort();break;
case 0:break;
default:Wrong();break;
}
return choose;
}
void destroy()
{
linklist p=head->next;
while(p!=last)
{
head->next=p->next;
free(p);
p=head->next;
}
free(head);
free(last);
}
int main(void)
{
head=(linklist)malloc(sizeof(node));
last=(linklist)malloc(sizeof(node));
head->next=last;
last->next=NULL;
last->pre=head;
head->pre=NULL;
do
{
menu();
} while (select()!=0);
destroy();
return 0;
}
『陸』 用c語言編寫工資管理系統
程序名稱:工資管理系統
程序說明:
該系統在磁碟上儲存了某單位上月全體員工的工資信息,對於每一位職工存儲以下信息:
月份,職工編號,基本工資,津貼,崗貼,補貼,房貼,交通補貼,應發數,房租,儲蓄,
會費,個人所得稅,應扣數,實發數。
工資管理系統詳細代碼參考一下http://wenku..com/view/c9af1211cc7931b765ce15d3.html
『柒』 用C語言設計職工工資管理系統
#include<iostream.h>
#include<stdlib.h>
#include<string.h>
#include<iomanip.h>
using namespace std;
#define OK 1
#define ERROR 0
typedef struct LNode{
char num[20];
char name[20];
double basic;
double reward;
double total;
struct LNode *next;
}LNode,*LinkList; int initlist(LinkList &L)
{ L=(LinkList)malloc(sizeof(LNode));
L->next=NULL;
return OK;
} int DisplayInfo(LinkList L)
{
LinkList p=L->next;
if(!p)
{
cout<<"當前無記錄!"<<endl;
return ERROR;
}
cout<<"編號"<<setw(12)<<"姓名"<<setw(12)<<"基本工資"<<setw(9)<<"獎金"<<setw(12)<<"工資總額"<<endl; while(p!=NULL)
{
cout<<p->num<<setw(9)<<p->name<<setw(8)<<p->basic<<setw(12)<<p->reward<<setw(12)<<p->total<<endl;
p=p->next;
}
cout<<'\n'<<'\n';
return OK;
} int InputInfo(LinkList &L)
{
LinkList p; p=(LinkList)malloc(sizeof(LNode));
cout<<"請輸入職工工資信息:(格式如:2001001 james 1980 600 )"<<endl;
cin>>p->num;
cin>>p->name;
cin>>p->basic;
cin>>p->reward;
p->total=p->basic+p->reward;
p->next=L->next;
L->next=p; return OK;
}int DeleteByCode(LinkList &L,char key[])
{
LinkList p=L,q;
while(p->next!=NULL)
{
if(strcmp(p->next->num,key)==0)
{
q=p->next;
p->next=q->next;
free(q);
return OK;
}
p=p->next;
}
return ERROR;} int Search(LinkList L,int tag)
{
LinkList p=L->next;
if(tag==1)
{
char num[20];
cout<<"請輸入要查找職工編號號:"<<endl;
cin>>num;
while(p)
{
if(strcmp(p->num,num)==0)
{
cout<<"編號"<<setw(12)<<"姓名"<<setw(12)<<"基本工資"<<setw(9)<<"獎金"<<setw(12)<<"工資總額"<<endl;
cout<<p->num<<setw(9)<<p->name<<setw(8)<<p->basic<<setw(12)<<p->reward<<setw(12)<<p->total<<endl;
cout<<'\n';
return OK;
}
p=p->next;
}
}
else if(tag==2)
{
char name[20];
cout<<"請輸入要查找的姓名:"<<endl;
cin>>name;
while(p)
{
if(strcmp(p->name,name)==0)
{
cout<<"編號"<<setw(12)<<"姓名"<<setw(12)<<"基本工資"<<setw(9)<<"獎金"<<setw(12)<<"工資總額"<<endl;
cout<<p->num<<setw(9)<<p->name<<setw(8)<<p->basic<<setw(12)<<p->reward<<setw(12)<<p->total<<endl;
cout<<'\n';
return OK;
}
p=p->next;
}
}
else
cout<<"輸入錯誤!"<<endl;
return ERROR;}
int Sort(LinkList &L)
{
LinkList p;
LinkList q,min,w=L;
for(p=L->next;p->next;p=p->next)
{
min=p;
for(q=p->next;q;q=q->next) if(min->total>q->total)
min=q; if(min!=p)
{ strcpy(w->num,p->num);
strcpy(w->name,p->name);
w->basic=p->basic;
w->reward=p->reward;
w->total=p->total;
strcpy(p->num,min->num);
strcpy(p->name,min->name);
p->basic=min->basic;
p->reward=min->reward;
p->total=min->total;
strcpy(min->num,w->num);
strcpy(min->name,w->name);
min->basic=w->basic;
min->reward=w->reward;
min->total=w->total; }
}
return OK;
}
int change(LinkList &L)
{
LinkList p=L->next;
char q[20];
cout<<"請輸入要修改的職工編號號:"<<endl;
cin>>q;
while(p)
{
if(strcmp(p->num,q)==0)
{
cout<<"編號"<<setw(12)<<"姓名"<<setw(12)<<"基本工資"<<setw(9)<<"獎金"<<setw(12)<<"工資總額"<<endl;
cout<<p->num<<setw(9)<<p->name<<setw(8)<<p->basic<<setw(12)<<p->reward<<setw(12)<<p->total<<endl;
cout<<"請重新輸入該職工的工資信息:"<<endl;
cin>>p->basic;
cin>>p->reward;
cout<<'\n';
return OK;
}
p=p->next;
}
}
int Menu(LinkList &S)
{
int sign=1;
while(sign)
{
int i;
cout<<"請選擇要進行的操作:1:插入 2:刪除 3:輸出 4:查找 5:排序 6:修改 0:退出"<<endl;
cin>>i;
if(i==1)
{ if(InputInfo(S))
cout<<"操作成功!"<<endl;
cout<<'\n';
}
else if(i==2)
{
char num[20];
cout<<"請輸入要刪除的職工編號:"<<endl;
cin>>num; if(DeleteByCode(S,num))
cout<<"操作成功!"<<endl; else
{
cout<<"此編號不存在!"<<endl;
cout<<'\n';
}
}
else if(i==3)
DisplayInfo(S);
else if(i==4)
{
int tag;
cout<<"1:按編號查找 2:按姓名查找 "<<endl;
cin>>tag;
if(!Search(S,tag))
cout<<"未找到!"<<endl;
cout<<'\n'; }
else if(i==5)
{
if(Sort(S));
cout<<"操作成功!"<<endl;
cout<<'\n';
}
else if(i==6)
{
if(change(S))
cout<<"修改成功!"<<endl;
} else if(i==0)
sign=0;
else
cout<<"輸入有誤,請重新輸入!"<<endl;
cout<<'\n';
}
return OK;
}
int main()
{
LinkList S;
initlist(S);
Menu(S);
return OK;} 已經調試無bug 有問題的話聯系我。
『捌』 C語言設計 工資管理系統
沒人做的話,我可以幫你試試 做好加加分神馬的~
『玖』 工資管理系統C語言
代碼還沒有完善好,實在沒時間了,最近太忙。先給你吧
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int addmenu();
int menu();
typedef struct teacher{
char name[32];
char unit[32];
float salary;
float allowance;
float tax;
float total;
struct teacher *next;
}TEACHER; //節點的結構體,包含數據和指針.
TEACHER *head;//頭節點
void init() //初始化頭節點
{
head=(TEACHER *)malloc(sizeof(TEACHER));
head->next=NULL;
}
void add(TEACHER *nod) //添加節點
{
if(head->next==NULL){
head=nod;
}
else
{
nod->next=head->next;
head->next=nod;
}
}
TEACHER *search(char *s) //遍歷整個鏈表並列印數據
{
TEACHER *nod=head;
while(nod->next !=NULL)//!循環到最後一個節點,有問題。。
{
if((!strcmp(nod->name,s)) || (!strcmp(nod->unit,s))){
printf("姓名:%s\n單位:%s\n基本工資:%f\n津貼:%f\n扣稅:%f\n總工資:%f\n",nod->name,nod->unit,nod->salary,nod->allowance,nod->tax,nod->tax);
return nod;
}
nod++;
}
printf("未找到數據\n");
return NULL;
}
void modify(TEACHER *s)
{
char name[16],unit[16];
float salary,allowance,tax,total;
gets(name);
strcpy(s->name,name);
gets(unit);
strcpy(s->unit,unit);
scanf("%f",&salary);
s->salary=salary;
scanf("%f",&allowance);
s->allowance=allowance;
scanf("%f",&tax);
s->tax=tax;
scanf("%f",&total);
s->total=total;
}
void del(char *s)
{
TEACHER *nod=head;
while(nod->next !=NULL)
{
if((!strcmp(nod->next->name,s))||(!strcmp(nod->next->unit,s))){
nod->next=nod->next->next;
nod->next=NULL;
}
}
}
int addmenu()//添加教師信息子菜單
{
TEACHER *node;
char command;
float salary,allowance,tax,total;
system("cls");
printf("****************************\n");
printf("* 添加子菜單 *\n");
printf("****************************\n");
printf("說明:4.返回主菜單 5.添加\n");
printf("請選擇需要使用的功能:");
fflush(stdin);
while((command=getchar())!='4')
{
if(command==4)
break;
printf("添加信息:\n");
node=(TEACHER *)malloc(sizeof(TEACHER));
fflush(stdin);
printf("姓名:");
fflush(stdin);
gets(node->name);
printf("單位:");
fflush(stdin);
gets(node->unit);
printf("基本工資:");
fflush(stdin);
scanf("%f",&salary);
node->salary=salary;
printf("津貼:");
scanf("%f",&allowance);
node->allowance=allowance;
fflush(stdin);
printf("扣稅:");
scanf("%f",&tax);
node->tax=tax;
fflush(stdin);
printf("總工資:");
scanf("%f",&total);
node->total=total;
fflush(stdin);
add(node);
fflush(stdin);
printf("輸入c退出,其他字元繼續\n");
if((command=getchar())=='c')
break;
}
return 0;
}
int save()
{
TEACHER *nod=head;
FILE *fp;
if((fp=fopen("teacher.txt","w+")) == NULL)
{
printf("打開文件異常\n");
return 0;
}
while(nod->next != NULL)
{
if(fwrite(nod,sizeof(TEACHER),1,fp)!=1){
printf("寫入異常\n");
return 0;
}
nod++;
}
fclose(fp);
return 1;
}
int searchmenu()
{
char name[16];
char command;
system("cls");
printf("****************************\n");
printf("* 查詢和修改子菜單 *\n");
printf("****************************\n");
printf("說明:4.返回主菜單 5.通過姓名/查找 6.修改 \n");
fflush(stdin);
printf("請輸出需要實現的操作:");
while((command=getchar()) !='4')
{
switch(command)
{
case '4': break;
case '5':
printf("請輸入需要查找的姓名:");
fflush(stdin);
gets(name);
search(name);
break;
// case '6': modify();break;
}
printf("請輸出需要實現的操作:");
}
return 0;
}
int menu()
{
char command;
int i,j=10;
system("cls");
printf("****************************\n");
printf("* 工資管理系統 *\n");
printf("****************************\n");
printf("----------------------------\n");
printf("說明:1.添加 2.查詢/修改 3.保存 4.退出\n");
printf("----------------------------\n");
printf("請輸出需要實現的操作:");
while((command=getchar())!='4'){
switch(command)
{
case '1': addmenu(); break;
case '2': searchmenu();break;
case '3': i=save();if(i)printf("保存成功!\n"); while(j--);break;
}
fflush(stdin);
/*子函數退出後再次顯示主界面*/
system("cls");
printf("****************************\n");
printf("* 工資管理系統 *\n");
printf("****************************\n");
printf("----------------------------\n");
printf("說明:1.添加 2.查詢/修改 3.保存 4.退出\n");
printf("----------------------------\n");
printf("請輸出需要實現的操作:");
}
printf("******感謝您使用本系統******\n");
return 0;
}
int main()
{
init();
menu();
return 0;
}