c工资管理系统源码
① c语言,编写职工工资管理系统,求源代码...急QWQ
用C语言不太现实,这样的程序最好用高级语言环境,.NET,或者直接用access
② 求用C语言编写一个工资管理系统程序的源代码,要用链表编
这家伙真牛,求一套程序给10分
我做一套程序,求了5条代码,花了500分
③ 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语言 工资管理系统
这个要靠调试了,不过有时候调试可能还不如重写快,可以帮写
⑤ 职工工资管理系统,求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语言编写工资管理系统
这个可以帮你
⑧ 工资管理系统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;
}
⑨ 求C语言 工资管理系统 原代码
#include <iostream>
#include <string>
#define MaxHEAP 100
using namespace std;
class Elem{
private:
int objectID;
int priority;
string proName;
public:
Elem(int objectID=0,int priority=0){
setID(objectID);
setPri(priority);
setProN(proName);
}
int getID(){
return objectID;
}
int getPri(){
return priority;
}
string getProN(){
return proName;
}
void setID(int id){
objectID=id;
}
void setPri(int pri){
priority=pri;
}
void setProN(string s)
{
proName=s;
}
};
class Heap
{
private:
Elem items[MaxHEAP];
int size;
public :
Heap(){
Elem items[MaxHEAP];
setSize(0);}
void setSize(int sz)
{size=sz;}
int heapIsEmpty(){
return size==0;
}
void heapInsert(Elem newItem)
{if(size<MaxHEAP)
{
items[size]=newItem;
int place=size;
int parent=(place-1)/2;
while((parent>=0)&&(items[parent].getPri()<items[place].getPri()))
{
Elem temp=items[parent];
items[parent]=items[place];
items[place]=temp;
place=parent;
parent=(place-1/2);
}
++size;
}
heapRebuild(0);
}
Elem heapDelete(int ID)
{
Elem rootItem;
if(!heapIsEmpty())
{
for(int i=0;i<size;i++)
if(items[i].getID()==ID)
{rootItem=items[i];
swap(items[i],items[0]);
}
items[0]=items[--size];
heapRebuild(0);
}
else cout<<"\n错误:目录为空"<<endl;
return rootItem;
}
void heapInit(){
setSize(0);
cout<<"空的项目"<<endl;}
void heapView(){
if(size==0){
cout<<"空的项目!"<<endl;
}
else{
cout<<"共有项目数: "<<size<<endl;
for(int ct=0;ct<size;ct++){
cout<<"ID: "<<items[ct].getID()<<" 优先级: "<<items[ct].getPri()
<<" 工资数目: " <<items[ct].getProN()<<endl;
}
}
}
void search(int ID)
{ int N=0;
for(int i=0;i<size;i++)
if(items[i].getID()==ID)
{N++;
cout<<"ID: "<<items[i].getID()<<" 优先级: "<<items[i].getPri()
<<" 名称: " <<items[i].getProN()<<endl; }
if(!N) cout<<"未找到匹配的ID"<<endl;
}
void heapRebuild(int root)
{
int child=2*root+1;
if(child<size)
{
int rightChild=child+1;
if((rightChild<size)&&(items[rightChild].getPri()>=items[child].getPri()))
{child=rightChild;
}
if(items[root].getPri()<=items[child].getPri())
{
Elem temp=items[root];
items[root]=items[child];
items[child]=temp;
heapRebuild(child);
}
}
}
};
class priQueue
{private:
Heap h;
public:
priQueue(){
Heap();
}
int priIsEmpty(){
return h.heapIsEmpty();
}
void priInit(){
h.heapInit();
}
void priInsert(Elem newItem){
h.heapInsert(newItem);
}
Elem priDelete(int ID){
return h.heapDelete(ID);
}
void priView(){h.heapView();
}
void search(int ID)
{
h.search(ID);
}
};
void showMenu(){
cout<<"------------------------------------------------"<<endl;
cout<<"-----------------*工资管理系统*-----------------"<<endl;
cout<<"------------------------------------------------"<<endl;
cout<<" 1.重置"<<endl;
cout<<" 2.输入"<<endl;
cout<<" 3.删除"<<endl;
cout<<" 4.查询"<<endl;
cout<<" 5.打印"<<endl;
cout<<" 0.退出"<<endl;
cout<<"------------------------------------------------"<<endl;
}
void showTip(){
cout<<"---------------------------------^_^--操作完成!"<<endl;
cout<<"------------------------------------选择0-5继续"<<endl;
}
int main(){
string i="-1";
int ID,PRI;
string proName;
Elem in;
priQueue PQ;
PQ.priInit();
system("cls");
showMenu();
cout<<"选择菜单中的数字以便处理数据!"<<endl;
cin>>i;
system("cls");
while(i!="0")
{ if(i=="1")
{ system("cls");
showMenu();
cout<<"你选择了1,项目将全部清空:"<<endl;
PQ.priInit();
showTip();
}
else if(i=="2")
{system("cls");
showMenu();
cout<<"你选择了2,输入ID,优先级,工资"<<endl;
cout<<"输入 ID(数字):"<<endl;
cin>>ID;
cout<<"输入优先级(数字):"<<endl;
cin>>PRI;
cout<<"输入工资数目(数字):"<<endl;
cin>>proName;
in.setID(ID);
in.setPri(PRI);
in.setProN(proName);
PQ.priInsert(in);
showTip();
}
else if(i=="3")
{system("cls");
showMenu();
cout<<"你选择了3,请选择你要删除的ID号"<<endl;
cin>>ID;
PQ.priDelete(ID);
showTip();
}
else if(i=="4")
{system("cls");
showMenu();
cout<<"你选择了4,输入要查找的项目ID号"<<endl;
cin>>ID;
PQ.search(ID);
showTip();
}
else if(i=="5")
{system("cls");
showMenu();
cout<<"你选择了5,整个系统工资情况显示如下:"<<endl;
PQ.priView();
showTip();
}
else {
system("cls");
showMenu();
cout<<"无效输入!"<<endl;
}
cin>>i;
system("cls");
}
return 0;
}