c语言编写的 工资管理系统
C语言 课程设计 教师工资管理系统(职工工资管理系统)

课程设计教师工资管理系统运行平台:VC6.0(其他平台未经测试,不一定保证有效)制作者:弓箭中南大学信息科学与工程学院源代码如下:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>#define LEN sizeof(struct teacher)struct teacher{int num;char name[20];char sex[20];char workplace[50];char address[50];long phone;double de_salary;double de_jintie;double de_shenghuobutie;double yingfa_salary;double cost_phone;double cost_water_elec;double cost_rent;double cost_tax;double cost_weisheng;double cost_gongjijin;double cost_all;double shifa_salary;struct teacher *next;};/***********************************读取函数************************************/ struct teacher *load(){struct teacher *p1,*p2,*head;FILE *fp;int i=1;if((fp=fopen("save","rb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();return (NULL);}else{head=NULL;p1=(struct teacher *)malloc(LEN);while (fread(p1,LEN-4,1,fp)==1){if(i==1){head=p1;p2=p1;i=2;}else{p2->next=p1;p2=p2->next;}p1=(struct teacher *)malloc(LEN);}p2->next=NULL;free(p1);fclose(fp);return(head);}}/**********************************欢迎菜单函数*************************************/ void welcome(){printf("\n\n\n >>>>>欢迎使用教师工资管理系统Beta1.2<<<<<\n");printf(" *******************************************************\n");printf(" * C语言课程设计教师工资管理系统*\n");printf(" * 班级:电气信息类1001班学号:0909100119 *\n");printf(" * 姓名:弓箭*\n");printf(" *******************************************************\n");printf("\n\n 按下任意键进入系统...");getch();system("cls");}/**********************************制作人员名单*************************************/void list(){system("cls");printf("\n\n\n >>>>>版权所有侵权必究<<<<<\n");printf("*******************************************************************************\n");printf("* 学校(College): 中南大学Central South University *\n");printf("* 软件名称(Software):教师工资管理系统Teacher's Salary Managing System *\n");printf("* 版本号(Edition): Beta1.2 *\n");printf("* 制作人(Producer):弓箭James *\n");printf("* 所在班级(Class):电气信息类1001班Electric Information 1001 *\n");printf("* 所在学院(Institute):信息科学与工程学院Information Engineering Institute*\n");printf("*******************************************************************************\n");printf(" >>>>>ILLEGAL COPY BANNED<<<<<\n");printf("\n\n 按下任意键返回主菜单...");getch();}/***********************************菜单函数*****************************************/int menu(){int i;printf("\n\n\n >>>>>欢迎使用教师工资管理系统Beta1.2<<<<<\n");printf(" *******************************************************\n");printf(" * 1.输入教师信息*\n");printf(" * 2.插入教师信息*\n");printf(" * 3.修改教师信息*\n");printf(" * 4.删除教师信息*\n");printf(" * 5.浏览教师信息*\n");printf(" * 6.显示制作人员名单*\n");printf(" * 7.退出系统*\n");printf(" *******************************************************\n");printf(" 请输入你想要的操作:");scanf("%d",&i);getchar();return i;}/***********************************插入函数*****************************************/void input(){struct teacher *head,*p1,*p2,*p3,*px;int i,t;FILE *fp;char k,n='n',num[30],name[20];p1=p2=p3=px=(struct teacher *)malloc(LEN);if((head=load())!=NULL){do{n='n';printf(" 请输入要插入的教师信息:\n");printf(" ------------------------------\n");printf(" 请输入教工号:");gets(num);px->num=atoi(num);printf(" 请输入姓名:");gets(px->name);printf(" 请输入性别:");gets(px->sex);printf(" 请输入单位名称:");gets(px->workplace);printf(" 请输入家庭住址:");gets(px->address);printf(" 请输入联系电话:");gets(num);px->phone=atoi(num);printf(" 请输入基本工资:");gets(num);px->de_salary=atof(num);printf(" 请输入津贴:");gets(num);px->de_jintie=atof(num);printf(" 请输入生活补贴:");gets(num);px->de_shenghuobutie=atof(num);printf(" 请输入电话费:");gets(num);px->cost_phone=atof(num);printf(" 请输入水电费:");gets(num);px->cost_water_elec=atof(num);printf(" 请输入房租:");gets(num);px->cost_rent=atof(num);printf(" 请输入个人所得税:");gets(num);px->cost_tax=atof(num);printf(" 请输入卫生费:");gets(num);px->cost_weisheng=atof(num);printf(" 请输入公积金:");gets(num);px->cost_gongjijin=atof(num);px->yingfa_salary=px->de_salary+px->de_jintie+px->de_shenghuobutie;px->cost_all=px->cost_phone+px->cost_water_elec+px->cost_rent+px->cost_tax+px->cost_weisheng+px->cost_go ngjijin;px->shifa_salary=px->yingfa_salary-px->cost_all;printf(" 数据输入完毕,按下任意键继续...");getch();system("cls");printf("\n\n\n >>>>>>>>>>> 插入教师信息<<<<<<<<<<<\n");printf(" *******************************************************\n");printf(" * 1.输入教师号*\n");printf(" * 2.输入姓名*\n");printf(" * 3.返回上级菜单*\n");printf(" *******************************************************\n");printf(" 请选择插入方式:");scanf("%d",&i);getchar();while (i<1||i>3){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入要插入在哪条数据后面:");scanf("%d",&t);getchar();p1=head;while (p1->num!=t){if (p1->next!=NULL){ p1=p1->next;}else{printf(" 查找不到相关数据!\n");break;}}if (p1->num==t){printf("-----------------------------要插入的信息如下:--------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",px->num,px->name,px->sex,px->workplace,px->address,px ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf\n",px->cost_phone,px->cost_water_ele c,px->cost_rent,px->cost_tax,px->cost_weisheng,px->cost_gongjijin,px->cost_all);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",px->de_salary,px->de_jintie,px->de_shenghuobutie,px->yingfa_salary,px->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" 确定插入吗?(y或n):");scanf("%c",&k);getchar();}if (k=='y'||k=='Y'){if (p1->num==t){if(p1==head)/*如果插入点为头指针*/{p3=p1->next;p1->next=px;px->next=p3;p2=head;}else if(p1->next==NULL)/*如果插入点为末尾指针*/{p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1=p1->next;p1->next=px;px->next=NULL;}else{/*如果插入点为中间指针*/p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1=p1->next;p3=p1->next;px->next=p3;p1->next=px;}if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{do{fwrite(p2,LEN-4,1,fp);if(p2->next!=NULL)p2=p2->next;}while(p2->next!=NULL);if(p2!=head)fwrite(p2,LEN-4,1,fp);}fclose(fp);printf(" 插入成功!按下任意键继续...");getch();}}else {printf(" 插入已被取消!按下任意键继续...");getch();}break;case 2:printf(" 请输入要插入的教师姓名:");gets(name);p1=head;while (strcmp((p1->name),name)!=0){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (strcmp((p1->name),name)==0){printf("-----------------------------要插入的信息如下:--------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" 确定插入吗?(y或n):");scanf("%c",&k);getchar();}if (k=='y'||k=='Y'){if (strcmp((p1->name),name)==0){if(p1==head)/*如果插入点为头指针*/{p1->next=px;p2=head;}else if(p1->next==NULL)/*如果插入点为末尾指针*/{p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1=p1->next;p1->next=px;px->next=NULL;}else{/*如果插入点为中间指针*/p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1=p1->next;p1->next=px;p3=p3->next;px->next=p3;}if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{do{fwrite(p2,LEN-4,1,fp);if(p2->next!=NULL)p2=p2->next;}while(p2->next!=NULL);if(p2!=head)fwrite(p2,LEN-4,1,fp);}fclose(fp);printf(" 插入成功!按下任意键继续...");getch();}}else {printf(" 插入已被取消!按下任意键继续...");getch();}break;case 3:break;default :break;}if (i!=3){printf("\n 继续插入其他教师的信息吗?(y或n)");scanf("%c",&n);getchar();}}while((n=='y'||n=='Y')&&i!=3);}printf(" 数据插入成功!按下任意键返回主菜单...");getch();getchar();}/***********************************输入函数*****************************************/void insert(){FILE *fp;char m,num[30];struct teacher *p1;p1=(struct teacher *)malloc(LEN);if((fp=fopen("save","ab"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{printf(" 请输入教师信息:\n");do{printf(" ------------------------------\n");printf(" 请输入教工号:");gets(num);p1->num=atoi(num);printf(" 请输入姓名:");gets(p1->name);printf(" 请输入性别:");gets(p1->sex);printf(" 请输入单位名称:");gets(p1->workplace);printf(" 请输入家庭住址:");gets(p1->address);printf(" 请输入联系电话:");gets(num);p1->phone=atoi(num);printf(" 请输入基本工资:");gets(num);p1->de_salary=atof(num);printf(" 请输入津贴:");gets(num);p1->de_jintie=atof(num);printf(" 请输入生活补贴:");gets(num);p1->de_shenghuobutie=atof(num);printf(" 请输入电话费:");gets(num);p1->cost_phone=atof(num);printf(" 请输入水电费:");gets(num);p1->cost_water_elec=atof(num);printf(" 请输入房租:");gets(num);p1->cost_rent=atof(num);printf(" 请输入个人所得税:");gets(num);p1->cost_tax=atof(num);printf(" 请输入卫生费:");gets(num);p1->cost_weisheng=atof(num);printf(" 请输入公积金:");gets(num);p1->cost_gongjijin=atof(num);p1->yingfa_salary=p1->de_salary+p1->de_jintie+p1->de_shenghuobutie;p1->cost_all=p1->cost_phone+p1->cost_water_elec+p1->cost_rent+p1->cost_tax+p1->cost_weisheng+p1->cost_go ngjijin;p1->shifa_salary=p1->yingfa_salary-p1->cost_all;fwrite(p1,LEN-4,1,fp);printf(" 输入下一个?(y或n)");m=getchar();if(m!='y'&&m!='Y'){printf(" 数据保存成功!按下任意键返回主菜单...");getch();}getchar();}while (m=='y'||m=='Y');}fclose(fp);}/***********************************修改函数*****************************************/ void modify(){struct teacher *head,*p1,*p2;int i;FILE *fp;char m='n',n='n',num2[30];p1=head=(struct teacher *)malloc(LEN);if((head=load())!=NULL){do{int num=0;char name[20];p1=head;system("cls");printf("\n\n\n >>>>>>>>>>> 修改教师信息<<<<<<<<<<<\n");printf(" *******************************************************\n");printf(" * 1.输入教师号*\n");printf(" * 2.输入姓名*\n");printf(" * 3.返回上级菜单*\n");printf(" *******************************************************\n");printf(" 请选择修改方式:");scanf("%d",&i);getchar();while (i<1||i>3){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入要修改的教师号:");scanf("%d",&num);getchar();while (p1->num!=num){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (p1->num==num){system("cls");printf("\n\n\n >>>>>欢迎使用教师工资管理系统Beta1.2<<<<<\n");printf("----------------------------------原信息如下:---------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf\n",p1->cost_phone,p1->cost_water_ele c,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_all);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" *******************************************************\n");printf(" * 1.教师号 2.姓名*\n");printf(" * 3.性别 4.单位名称*\n");printf(" * 5.家庭住址 6.联系电话*\n");printf(" * 7.基本工资8.津贴*\n");printf(" * 9.生活补贴10.电话费*\n");printf(" * 11.水电费12.房租*\n");printf(" * 13.所得税14.卫生费*\n");printf(" * 15.公积金*\n");printf(" *******************************************************\n");do{printf(" 请选择要修改的数据:");scanf("%d",&i);getchar();while (i>15||i<1)printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入新教师号:");gets(num2);p1->num=atoi(num2);break;case 2:printf(" 请输入新姓名:");gets(p1->name);break;case 3:printf(" 请输入新性别:");gets(p1->sex);break;case 4:printf(" 请输入新单位名称:");gets(p1->workplace);break;case 5:printf(" 请输入新家庭住址:");gets(p1->address);break;case 6:printf(" 请输入新联系电话:");gets(num2);p1->phone=atoi(num2);break;case 7:printf(" 请输入新基本工资:");gets(num2);p1->de_salary=atof(num2);break;case 8:printf(" 请输入新津贴:");gets(num2);p1->de_jintie=atof(num2);break;case 9:printf(" 请输入新生活补贴:");gets(num2);p1->de_shenghuobutie=atof(num2);break;case 10:printf(" 请输入新电话费:");gets(num2);p1->cost_phone=atof(num2);break;case 11:printf(" 请输入新水电费:");gets(num2);p1->cost_water_elec=atof(num2);break;case 12:printf(" 请输入新房租:");gets(num2);p1->cost_rent=atof(num2);break;case 13:printf(" 请输入新所得税:");gets(num2);p1->cost_tax=atof(num2);break;case 14:printf(" 请输入新卫生费:");gets(num2);p1->cost_weisheng=atof(num2);break;case 15:printf(" 请输入新公积金:");gets(num2);p1->cost_gongjijin=atof(num2);break;default:break;}p1->yingfa_salary=p1->de_salary+p1->de_jintie+p1->de_shenghuobutie;p1->cost_all=p1->cost_phone+p1->cost_water_elec+p1->cost_rent+p1->cost_tax+p1->cost_weisheng+p1->cost_go ngjijin;p1->shifa_salary=p1->yingfa_salary-p1->cost_all;printf(" 继续修改其他数据吗?(y或n):");scanf("%c",&m);getchar();}while (m=='y'||m=='Y');p2=head;if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}elsefwrite(head,LEN-4,1,fp);do{p2=p2->next;fwrite(p2,LEN-4,1,fp);}while(p2->next!=NULL);printf("------------------------------修改后数据如下:---------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");}fclose(fp);}break;case 2:printf(" 请输入要修改的教师姓名:");gets(name);while (strcmp(p1->name,name)!=0){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (strcmp(p1->name,name)==0){system("cls");printf("\n\n\n >>>>>欢迎使用教师工资管理系统Beta1.2<<<<<\n");printf("----------------------------------原信息如下:---------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" *******************************************************\n");printf(" * 1.教师号 2.姓名*\n");printf(" * 3.性别 4.单位名称*\n");printf(" * 5.家庭住址 6.联系电话*\n");printf(" * 7.基本工资8.津贴*\n");printf(" * 9.生活补贴10.电话费*\n");printf(" * 11.水电费12.房租*\n");printf(" * 13.所得税14.卫生费*\n");printf(" * 15.公积金*\n");printf(" *******************************************************\n");do{printf(" 请选择要修改的数据:");scanf("%d",&i);getchar();while (i>15||i<1){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入新教师号:");gets(num2);p1->num=atoi(num2);break;case 2:printf(" 请输入新姓名:");gets(p1->name);break;case 3:printf(" 请输入新性别:");gets(p1->sex);break;case 4:printf(" 请输入新单位名称:");gets(p1->workplace);break;case 5:printf(" 请输入新家庭住址:");gets(p1->address);break;case 6:printf(" 请输入新联系电话:");gets(num2);p1->phone=atoi(num2);break;case 7:printf(" 请输入新基本工资:");gets(num2);p1->de_salary=atof(num2);break;case 8:printf(" 请输入新津贴:");gets(num2);p1->de_jintie=atof(num2);break;case 9:printf(" 请输入新生活补贴:");gets(num2);p1->de_shenghuobutie=atof(num2);break;case 10:printf(" 请输入新电话费:");gets(num2);p1->cost_phone=atof(num2);break;case 11:printf(" 请输入新水电费:");gets(num2);p1->cost_water_elec=atof(num2);break;case 12:printf(" 请输入新房租:");gets(num2);p1->cost_rent=atof(num2);break;case 13:printf(" 请输入新所得税:");gets(num2);p1->cost_tax=atof(num2);break;case 14:printf(" 请输入新卫生费:");gets(num2);p1->cost_weisheng=atof(num2);break;case 15:printf(" 请输入新公积金:");gets(num2);p1->cost_gongjijin=atof(num2);break;default:break;}p1->yingfa_salary=p1->de_salary+p1->de_jintie+p1->de_shenghuobutie;p1->cost_all=p1->cost_phone+p1->cost_water_elec+p1->cost_rent+p1->cost_tax+p1->cost_weisheng+p1->cost_go ngjijin;p1->shifa_salary=p1->yingfa_salary-p1->cost_all;printf(" 继续修改其他数据吗?(y或n):");scanf("%c",&m);getchar();}while (m=='y'||m=='Y');p2=head;if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{fwrite(head,LEN-4,1,fp);do{p2=p2->next;fwrite(p2,LEN-4,1,fp);}while(p2->next!=NULL);printf("------------------------------修改后数据如下:---------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");}fclose(fp);}break;case 3:break;default :break;}if (i!=3){printf("\n 继续修改其他教师的信息吗?(y或n)");scanf("%c",&n);}}while((n=='y'||n=='Y')&&i!=3);}}/***********************************删除函数*****************************************/void deletes(){struct teacher *head,*p1,*p2,*p3;int i;char k;FILE *fp;char n='n';p1=p2=p3=(struct teacher *)malloc(LEN);if((head=load())!=NULL){do{int num;char name[20];p1=head;system("cls");printf("\n\n\n >>>>>>>>>>> 删除教师信息<<<<<<<<<<<\n");printf(" *******************************************************\n");printf(" * 1.输入教师号*\n");printf(" * 2.输入姓名*\n");printf(" * 3.返回上级菜单*\n");printf(" *******************************************************\n");printf(" 请选择删除方式:");scanf("%d",&i);getchar();while (i<1||i>3){printf(" 输入有误!请重新输入:");scanf("%d",&i);getchar();}switch(i){case 1:printf(" 请输入要删除的信息的教师号:");scanf("%d",&num);getchar();while (p1->num!=num){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (p1->num==num){printf("-----------------------------要删除的信息如下:--------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf\n",p1->cost_phone,p1->cost_water_ele c,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_all);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" 确定删除吗?(y或n):");scanf("%c",&k);getchar();}if (k=='y'||k=='Y'){if (p1->num==num){if(p1==head){p1=p1->next;p2=p1;}else if(p1->next==NULL){p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1->next=NULL;}else{p2=head;p3=p1;p1=head;while(p1->next!=p3){p1=p1->next;}p3=p3->next;p1->next=p3;}if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{do{fwrite(p2,LEN-4,1,fp);if(p2->next!=NULL)p2=p2->next;}while(p2->next!=NULL);if(p2!=head)fwrite(p2,LEN-4,1,fp);}fclose(fp);printf(" 删除成功!按下任意键继续...");getch();}}else {printf(" 删除已被取消!按下任意键继续...");getch();}break;case 2:printf(" 请输入要修改的教师姓名:");gets(name);while (strcmp((p1->name),name)!=0){if (p1->next!=NULL)p1=p1->next;else{printf(" 查找不到相关数据!\n");break;}}if (strcmp((p1->name),name)==0){printf("-----------------------------要删除的信息如下:--------------------------------\n");printf("教工号姓名性别单位名称家庭住址联系电话\n");printf(" %-4d %-13s %s %-19s %-19s%-14ld\n",p1->num,p1->name,p1->sex,p1->workplace,p1->address,p1 ->phone);printf("电话费水电费房租个人所得税卫生费公积金合计扣款\n");printf(" %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf %-10.1lf \n",p1->cost_phone,p1->cost_water_elec,p1->cost_rent,p1->cost_tax,p1->cost_weisheng,p1->cost_gongjijin,p1->cost_al l);printf("基本工资津贴生活补贴应发工资实发工资\n");printf(" %-13.1lf %-13.1lf %-13.1lf %-13.1lf %-13.1lf\n",p1->de_salary,p1->de_jintie,p1->de_shenghuobutie,p1->yingfa_salary,p1->shifa_salary);printf("-------------------------------------------------------------------------------\n");printf(" 确定删除吗?(y或n):");scanf("%c",&k);getchar();}if (k=='y'||k=='Y'){if (strcmp((p1->name),name)==0){if(p1==head){p1=p1->next;p2=p1;}else if(p1->next==NULL){p3=p1;p1=head;p2=head;while(p1->next!=p3){p1=p1->next;}p1->next=NULL;}else{p2=head;p3=p1;p1=head;while(p1->next!=p3){p1=p1->next;}p3=p3->next;p1->next=p3;}if((fp=fopen("save","wb"))==NULL){printf(" 文件不存在!按下任意键返回主菜单...");getch();}else{do{fwrite(p2,LEN-4,1,fp);if(p2->next!=NULL)p2=p2->next;}while(p2->next!=NULL);if(p2!=head)fwrite(p2,LEN-4,1,fp);}fclose(fp);printf(" 删除成功!按下任意键继续...");getch();}}else {printf(" 删除已被取消!按下任意键继续...");getch();}break;case 3:break;default :break;}if (i!=3){printf("\n 继续删除其他教师的信息吗?(y或n)");scanf("%c",&n);}}while((n=='y'||n=='Y')&&i!=3);}。
员工工资管理系统(c语言编程)

#include<stdio。
h>#include<string.h>#include<ctype。
h〉#include〈malloc.h>#define null 0typedef struct Info1{char num[10];char name[10];char depar[10];char yfsalary[10];char aband[10];char tax[10];char sfsalary[10];struct Info1 *next;}Info2;typedef struct Info1 *Info;Info head;void display();void find();void modify();void add();void del();void list();void 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("\t\t.。
退出系统!\n”);return;default:printf(”\t\t输入错误!请按任意键返回重新选择(1-7)\n");getchar();}}}void display(){printf(”\n\t**欢迎使用员工信息管理系统**\n\n");printf(”\t请选(1—7):\n”);printf("\t============================================\n");printf("\t\t1。
员工工资管理系统c语言编程精编

员工工资管理系统c语言编程精编Document number:WTT-LKK-GBB-08921-EIGG-22986#include<>#include<>#include<>#include<>#define null 0typedef struct Info1{char num[10];char name[10];char depar[10];char yfsalary[10];char aband[10];char tax[10];char sfsalary[10];struct Info1 *next;}Info2;typedef struct Info1 *Info; Info head;void display();void find();void modify();void add();void del();void list();void 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("\t\t...退出系统!\n");return;default: printf("\t\t输入错误!请按任意键返回重新选择(1-7)\n");getchar();}}}void display(){printf("\n\t** 欢迎使用员工信息管理系统**\n\n");printf("\t请选(1-7):\n");printf("\t===================================== =======\n");printf("\t\t1.查询员工信息\n");printf("\t\t2.录入员工信息\n");printf("\t\t3.修改员工信息\n");printf("\t\t4.删除员工信息\n");printf("\t\t6.显示所有员工信息\n");printf("\t\t7.退出系统\n");printf("\t===================================== =======\n");printf("\t您的选择是: ");}void listOne(Info p){printf("\n该员工信息记录如下: ");printf("\n===================================== =====================\n\n");printf("%-12s%-10s%-10s%-7s%-7s%-10s%-10s%\n","员工编号","姓名","部门","应付工资","保险","税金","实付工资");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)return p;p=q;q=p->next;}return p;}void add(){Info p,q;char num[10];q=(Info)malloc(sizeof(Info2));printf("\t\t请输入员工编号: ");scanf("%s",num);p=isExists(num);if (p->next==null){strcpy(q->num,num);printf("\t\t请输入员工姓名: ");scanf("%s",q->name);printf("\t\t请输入该员工的部门: ");scanf("%s",q->depar);printf("\t\t请输入该员工的应付工资金额: ");scanf("%s", q->yfsalary);printf("\t\t请输入该员工的保险金额: ");scanf("%s", q->aband);printf("\t\t请输入该员工的税金金额: ");scanf("%s",q->tax);printf("\t\t请输入该员工的实付工资: ");scanf("%s",q->sfsalary);q->next=null;p->next=q;}elseprintf("\n\t\t您所输入的员工编号以存在! "); printf("\n\t\t按任意键返回住菜单......"); getchar();}void del(){Info p,q;char num[10];if (head->next==null){printf("\n\t\t当前还没有员工信息记录,按任意键返回主菜单......");getchar();return;}printf("\t\t请输入员工编号: ");scanf("%s",num);p=isExists(num);q=p->next;if (q!=null){q=q->next;p->next=q;printf("\n\t\t删除成功! ");}elseprintf("\n\t\t您所输入的员工编号有误或不存在! ");printf("\n\t\t按任意键返回主菜单......");getchar();}void modify(){Info p,q;char num[10];if (head->next==null){printf("\n\t\t当前还没有员工信息记录,按任意键返回主菜单......");getchar();return;}printf("\t\t请输入员工编号: ");scanf("%s",num);p=isExists(num);q=p->next;if(q!=null){listOne(q);printf("\t\t请输入该员工的新姓名: ");scanf("%s",q->name);printf("\t\t请输入该员工的部门: ");scanf("%s",q->depar);printf("\t\t请输入该员工的应付工资金额: ");scanf("%s",q->yfsalary);printf("\t\t请输入该员工的保险: ");scanf("%s",q->aband);printf("\t\t请输入该员工的新税金金额: ");scanf("%s",q->tax);printf("\t\t请输入该员工的新实付工资: ");scanf("%s",q->sfsalary);}elseprintf("\n\t\t您所输入的员工编号有误或不存在!");printf("\n\t\t按任意键返回主菜单......");getchar();}void list(){Info p;if (head->next==null){printf("\n\t\t当前还没有员工信息记录,按任意键返回主菜单......");getchar();return;}printf("\n所有员工信息记录如下: ");printf("\n===================================== ===================================\n\n");printf("%-12s%-10s%-10s%-7s%-7s%-10s%-10s%\n","员工编号","姓名","部门","应付工资","保险","税金","实付金额");p=head->next;while(p!=null){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("\n\t\t按任意键返回主菜单......");getchar();}void find(){Info p;char num[10];if (head->next==null){printf("\n\t\t当前还没有员工信息记录,按任意键返回主菜单......");getchar();return;}printf("\t\t输入员工编号: ");scanf("%s",num);p=isExists(num);p=p->next;if(p!=null)listOne(p);elseprintf("\n\t\t您所输入的员工信息有误或不存在!");printf("\n\t\t按任意键返回主菜单......");getchar();}。
员工工资管理系统(c语言编程)6页

员工工资管理系统(c语言编程)6页一、设计目标1、完成一个员工工资管理系统,包括对员工信息的添加、删除、修改和查询、员工工资管理和统计等功能。
2、程序必须具备易用性、可靠性、安全性和稳定性等特点。
二、程序结构设计员工工资管理系统是由若干模块构成的一个整体,它们之间相互联系,共同完成对员工信息的处理和管理。
程序分为主界面模块、添加模块、删除模块、修改模块、查询模块、统计模块、退出模块。
三、模块功能设计1、主界面模块主界面包括菜单栏和功能栏,菜单栏包括添加、删除、修改、查询、统计和退出功能,功能栏是对主界面菜单的补充,包括一些快捷操作按钮。
2、添加模块添加模块是用来录入员工信息的,可以录入的信息有员工编号、员工姓名、员工部门、员工工作年限、员工基本工资、员工奖金等。
添加模块会对信息进行一系列的校验,要求信息必须完整正确才能录入。
3、删除模块删除模块是用来删除员工信息的,输入员工编号就可以删除该员工的信息。
5、查询模块查询模块提供了多种查询方式,包括按部门查询、按姓名查询、按工作年限查询、按基本工资查询、按奖金查询等。
查询结果会按照员工编号的顺序进行排序。
6、统计模块统计模块会根据查询结果进行工资统计,包括总工资、平均工资、最高工资和最低工资等。
7、退出模块退出模块是用来关闭程序的,保证程序的安全性和稳定性。
四、程序流程设计1、主界面程序启动后,会显示主界面界面,包括菜单栏和功能栏。
2、录入信息点击添加功能或者添加按钮,会进入添加模块,要求用户输入员工信息,录入完成后数据将保存到文件中。
4、修改信息点击修改功能或者修改按钮,会进入修改模块,输入员工编号,然后修改员工信息。
5、查询信息点击查询功能或者查询按钮,会进入查询模块,选择查询方式,输入查询条件,系统将显示符合条件的员工信息。
6、工资统计当查询完成后,点击统计功能或者统计按钮,会进入统计模块,系统将根据查询结果进行统计。
7、程序退出当操作完成后,点击退出功能或者退出按钮,会关闭程序。
c语言课程设计职工工资管理系统

一、概述随着社会的发展和进步,工资管理系统在企业管理中扮演着重要的角色。
为了提高工资管理的效率和准确性,许多企业都倾向于引入计算机系统来进行工资管理。
C语言是一种广泛应用于系统程序设计和应用程序开发的高级语言,具有跨评台性和高效性的特点。
设计一个基于C语言的职工工资管理系统将会成为一个有价值的课程设计。
二、系统功能需求1. 职工信息管理:系统需要能够记录、查看和修改职工的基本信息,包括尊称、工号、部门、入职日期等。
2. 薪资核算:系统应能根据职工的实际出勤、加班情况、请假情况等自动生成薪资,并能够灵活处理各类津贴和抠款。
3. 考勤管理:系统需要提供考勤记录的输入和查询功能,以便及时了解职工的工作情况。
4. 报表输出:系统需要能够生成各类工资报表,方便管理人员进行核对和统计。
5. 数据备份和恢复:系统应具备数据备份和恢复功能,以保证数据的安全性和完整性。
三、系统设计与技术选择在设计该系统时,应采用模块化、分层的设计思路,以便系统具有良好的可维护性和扩展性。
1. 界面设计:可以采用文本界面或图形界面进行设计,具体选择取决于系统的实际应用环境和用户需求。
2. 数据存储:可以选择采用文件系统或数据库来存储系统数据,常见的选择包括文本文件、CSV文件、SQLite数据库等。
3. 算法选择:需要根据系统的具体需求选择合适的算法来实现薪资核算和报表生成等功能。
4. 开发工具:可以选择C语言的集成开发环境(IDE)来进行开发,例如Visual Studio、Dev-C++等。
四、系统实现在进行系统开发时,需要按照设计要求逐步实现各个功能模块,同时进行严格的测试和调试工作,以确保系统的稳定性和准确性。
1. 职工信息管理模块:包括新增、修改、删除职工信息等功能。
2. 薪资核算模块:根据考勤情况自动生成薪资并进行津贴和抠款处理。
3. 考勤管理模块:提供考勤记录的输入和查询功能,确保数据的及时更新和准确性。
4. 报表输出模块:能够生成各类工资报表,包括月度工资表、年度工资统计表等。
工资管理系统c语言版

#include<stdio.h>//头文件#include<string.h>//字符处理头文件struct zhigong//定义结构体类型{int num;//定义char name[10];//定义float money;//定义float jiang;//定义float kou;//定义float ying;//定义float shi;//定义char ch;//定义}zhi[10000];//定义结构体变量int a;//定义全局变量char y[10];//定义字符数组void caidan()//菜单函数{int c;void input();//输入函数声明************************************void gongpai();//按工号排序函数声明******************************void print();//输出函数声明************************************void chaxun();//查询函数声明************************************void paixu();//排序函数声明************************************void tongji();//统计函数声明************************************void xiugai();//修改函数声明*************************************void cunchu(); //存储函数声明************************************void shanchu();//删除数据函数声明*********************************void charu();//插入数据函数声明***********************************printf(">>>>>>>>>>>>>>>>>>>>>>>>工资管理系统>>>>>>>>>>>>>>>>>>>>>\n");//提示**************************printf("\n");printf(" 输出数据请按1。
C语言课程设计教师工资管理系统说明书

添加标题
退出:点击退出按钮,系统将自 动退出
忘记密码:点击忘记密码按钮, 系统将发送重置密码邮件到用户 邮箱
界面操作指南
登录界面:输入用户名和密 码,点击登录按钮
添加标题
教师信息管理:添加、修改、 删除教师信息
工资信息管理:添加、修改、 删除工资信息
导出功能:将教师工资信息 导出为Excel文件
添加标题
系统安全与维护
06
用户权限管理
用户类型:管理员、教师、学生
权限设置:管理员拥有最高权限,可以添加、修改、删除用户和课程信息;教师可以查 看、修改自己的课程信息;学生只能查看自己的课程信息。
密码管理:用户需要设置密码,密码长度和复杂度有要求,密码错误次数过多将锁定账户。
安全策略:系统采用加密技术,确保数据传输和存储的安全性。
数据库: 存储教师 工资信息, 包括姓名、 职位、工 资等
接口:连 接前端和 后端,负 责数据传 输和转换
安全机制: 确保系统 安全,防 止数据泄 露和攻击
维护工具: 提供系统 维护和升 级功能, 保证系统 稳定运行
模块组成
用户界面 模块:负 责与用户 交互,接 收用户输 入,显示 系统运行 结果
报表格式:包括员工姓名、部门、职位、工资等级、基本工资、奖金、津贴、扣款、应发工资、 实发工资等
报表输出:支持Excel、PDF等多种格式输出,方便用户查看和打印
系统操作说明
05
登录与退出
登录:输入用户名和密码,点击 登录按钮
用户名和密码错误:系统将提示 错误信息,并重新输入
添加标题
添加标题
添加标题
YOUR LOGO
C语言课程设计教师工资管理系统说明 ,a click to unlimited possibilities 书
c语言课程设计工资管理系统

c语言课程设计工资管理系统一、教学目标本章节的教学目标是使学生掌握C语言的基本语法,能够运用C语言编写简单的工资管理系统程序。
具体分为以下三个部分:1.知识目标:使学生掌握C语言的数据类型、变量、运算符、控制结构、函数等基本语法知识。
2.技能目标:培养学生运用C语言进行程序设计的能力,使学生能够独立编写并调试简单的工资管理系统程序。
3.情感态度价值观目标:培养学生对计算机科学的兴趣和好奇心,提高学生解决问题的能力,培养学生的团队协作意识。
二、教学内容本章节的教学内容主要包括C语言的基本语法、数据类型、变量、运算符、控制结构、函数等。
具体安排如下:1.C语言的基本语法和编程环境:介绍C语言的编程规范,熟悉集成开发环境(如Visual Studio、Code::Blocks等)。
2.数据类型、变量和运算符:整型、浮点型、字符型数据,变量的声明和初始化,算术运算符、关系运算符、逻辑运算符等。
3.控制结构:顺序结构、选择结构(if-else)、循环结构(for、while、do-while)等。
4.函数:函数的定义和声明,调用函数,函数的返回值,函数的参数传递等。
5.工资管理系统实例:设计并实现一个简单的工资管理系统程序,包括员工信息的录入、工资的计算和输出等功能。
三、教学方法本章节的教学方法采用讲授法、案例分析法和实验法相结合的方式进行。
具体安排如下:1.讲授法:讲解C语言的基本语法、数据类型、变量、运算符、控制结构、函数等知识点,让学生系统地掌握C语言的基础知识。
2.案例分析法:通过分析实际的工资管理系统案例,让学生了解并掌握如何运用C语言解决实际问题。
3.实验法:让学生动手编写并调试工资管理系统程序,培养学生的实际编程能力和解决问题的能力。
四、教学资源本章节的教学资源包括教材、参考书、多媒体资料和实验设备等。
具体安排如下:1.教材:选用权威、实用的C语言教材,如《C程序设计语言》(K&R)、《C Primer Plus》等。
C语言工资管理系统

C语言课程设计-工资管理系统题目要求做一个工资管理系统,要能按照姓名和卡号查找员工的工资信息,以及员工工资信息的插入,删除。
同时这些信息要存储在TXT文件中…还要可以按照一定顺序输出所有员工工资的信息#include〈stdio.h〉#include〈string。
h〉#define N 100struct mygz{int yuefen;float yfgz;float sf;float df;float sj;float sfgz;};struct worker{int kahao;char xingming[20];struct mygz m[12];float zsfgz;};int ygsm;struct worker a[N];float shuijin(float m){float shui1,shui2;float tmp;shui1=0;shui2=0;if(m〉=1400){shui1=(m-1400)*0.1;shui2=30;}else{if(m〉=800 && m〈1400){shui2=(m—800)*0。
05;}}tmp=shui1+shui2;return(tmp);}float shifagongzi(float a,float b,float c,float d){float e=a—b—c-d;return(e);}void duqu(){FILE *fp;if((fp=fopen("D:工资信息.txt”,”r"))==NULL){printf(”无法读取文件”);;return;}while(!feof(fp)){fread(&a[ygsm],sizeof(struct worker),1,fp);ygsm++;}}void chaxun(){int b;int i;int j;label_3:b=0;while(b!=1&&b!=2){printf(”1,选择姓名查询.\n2,选择卡号查询.\n”);scanf(”%d",&b);}if(b==1){char c[20];printf("请输入您的姓名:\n");scanf(”%s”,c);i=0;while(!(strcmp(a[i]。
C语言工资管理系统

UintDataTotal.RP += UnitData[count].RP;
UintDataTotal.MI += UnitData[count].MI;
UintDataTotal.IT += UnitData[count].IT;
printf("︳ 1.原始数据的输入 ︳\n");
printf("-------------------------------------------------------\n");
printf("\n 按要求录入原始资料 \n");
UnitDataDetal[i].RP += UnitData[j].RP;
UnitDataDetal[i].RW += UnitData[j].RW;
UnitDataDetal[i].WE += UnitData[j].WE;
}
}
DepartmentRecord[DepartmentNumber]=i;
while (count<NumberofUnit)
{
printf("现在开始录入第 %d 个资料,共 %d 个资料。\n",count+1,NumberofUnit);
AddMember(count);
count ++;
}
}
void UI_GetData_All(void)
{
count =0;
do
{
if (count >0)
C语言做的工资管理系统

C语言课程设计报告-工资管理系统一. 系统功能1,输入记录模块主要完成将数据存入数组中的工作。
记录可以从以二进制形式存储的数据文件中读入,也可以从键盘逐个输入记录。
2,查询记录模块主要完成在数组中查找满足相关条件的记录。
在查询记录模块中,用户可以按照职工编号或者姓名在数组中进行查找。
3,更新记录模块主要完成对记录的维护。
在此工资管理系统中,实现对记录的修改、删除、插入、排序操作。
4,统计记录模块主要完成对公司员工的工资在各等级的人数统计。
5,输出记录模块主要完成两个任务:第一,它实现对记录的存盘操作,将数组中各元素的存储的记录信息写入数据文件中。
第二,它实现将数组中存储的记录信息以表格的形式在屏幕上打印出来。
6,从文件读入功能模块主要是将数据存放在数组中。
该模块从数据文件中读取所有记录,通过多次调用fread()文件函数,每次操作都是从文件中读取一条工资记录信息存入数组中的操作.7,从键盘输入功能模块主要实现记录从键盘上输入Add函数实现。
首先把文件中存在的记录全部显示出来,而后从键盘接收多次输入记录,如果职工编号重复则提醒重新输入,输入的记录暂保存到结构体数组中,输入0回到主菜单。
8,查询模块主要实现在结构体数组中按职工编号或姓名查找满足条件的记录的功能,通过Qur()函数来实现。
提供两种方式查询:1为按照编号来查询,2按照姓名来查询;如找到查询内容则输出记录值,找不到则提示无此项记录。
9,更新记录模块主要是实现对记录的修改、删除、插入、排序操作。
所有这些操作都在数组中完成。
修改记录操作需要对数组中目标元素的数据域中的值进行修改,分三步完成:首先显示所有的记录,然后输入要修改的职工编号,调用Locate()函数定位该职工的编号记录,第三步,若找到该记录,则修改职工编号之外的各字段的值。
10,删除记录操作完成删除制定的职工编号或者姓名的记录。
也分三步完成:首先显示所有的记录,而后输入要删除的职工编号或者姓名,输入后调用Locate()函数定位该职工的记录,第三步,若找到该记录,则从该记录所在元素的后续元素起,依次向前移一个元素位置,元素个数减1。
c语言编写的工资管理系统

/*程序名称:工资管理系统 *//*程序说明:该系统在磁盘上储存了某单位上月全体员工的工资信息,对于每一位职工存储以下信息:月份,职工编号,基本工资,津贴,岗贴,补贴,房贴,交通补贴,应发数,房租,储蓄,会费,个人所得税,应扣数,实发数。
个人所得税计算方法设定为:工资少于800元为0,800-1000元的部分为5%,1000-5000元的部分为10%,5000元以上的部分为20%。
该系统功能如下:1)创建存储职工工资信息的存储系统。
2)添加职工的工资信息(增加新职工时用)3)删除某职工的工资信息(职工离职或者死亡时用)4)修改某职工的部分工资信息(当月开始增加或减少某些项工资或扣款数变化)5)输出指定编号职工的工资信息(查询用)6)输出当月全体职工的工资信息(发工资用) *//*编写心得:2006年9月26日19:30-23:00共计3小时30分钟。
由于时间仓促,没有对代码进行优化设计。
对于主要的结构体也是粗粗设计了一下。
在存储上只采用了结构体数组,没用运用到二叉树等复杂的数据结构,有点遗憾。
主程序采用模块化设计,用独立的函数把功能分解开来,便于调试和扩展。
假如用C++就可以多做几个构造函数,可能会更方便点。
不过最近在学JAVA,不敢乱用C++了,怕到时候知识搞混了。
感觉稍微麻烦一点的地方是文件的输入输出部分,因为一般的书上这一章都比较靠后,老师上课也就简单的带过的,格式有点忘记了。
个人感觉现在靠C语言来做数据库不是很合适,50个元素的数组应该够了吧。
反正只要弄清那些常用函数,还有怎么一个I/O方式就可以了。
让偶想起了教偶C语言的班主任老童,想起了偶美好的青春,以及那些为了听课和MM们一大早抢前排坐位的幸福日子...总得来说还是比较轻松的,就是项目字段太多,写写麻烦(谁叫偶打字不快啊^_^)BY 雨田心梦*//* 为了调用FILE等函数 */#include "stdio.h"#include "conio.h"/* 为了调用atof()等函数 */#include "stdlib.h"#define TRUE 1/* 结构体声明 */struct zhigong{int month;float id;float jbgz;float jt;float gt;float bt;float ft;float jtbt;float yfs;float fz;float cx;float hf;float grsds;float yks;float sfs;};/* 建立50个元素的结构体数组 */ struct zhigong zg[50];/* 建立结构体变量 */struct zhigong zgone;/* 职员列表中的数量 */int n=0;/* 获得字符串 */char numstr[50];main(){char ch;n=0;/*rfile(); 使用后启动程序时系统会自动加载纪录*/while(TRUE){printf("\n");printf("===========================================\n");printf("Welcome!Please choice(1-6) : +\n");printf("1.Add oneinfomation +\n");printf("2.Delete oneinfomation +\n");printf("3.Modify oneinfomation +\n");printf("4.Print out byid +\n");printf("5.Print outall +\n");printf("6.Savedate +\n");printf("7.Loaddate +\n");printf("8.Exit+\n");printf("===========================================\n");ch=getche();switch(ch){case '1':addone();break;case '2':delone();break;case '3':modone();break;case '4':idone();break;case '5':listall();break;case '6':wfile();break;case '7':rfile();break;case '8':return;default:printf("Sorry,please choice again!\n");}}}/*计算个人所得税*/float tgrsds(float m){float sui1,sui2,sui3;float tmp;sui1=0;sui2=0;sui3=0;if(m>=5000){sui1=(m-5000)*0.2;sui2=(5000-1000)*0.1;sui3=(1000-800)*0.05;}else if(m>=1000 && m<5000){sui2=(m-1000)*0.1;sui3=(1000-800)*0.05;}else if(m>=800 && m<1000){sui3=(m-800)*0.05;}tmp=sui1+sui2+sui3;return(tmp);}/* 添加职工的工资信息 */ addone(void){printf("\n");printf("Record NO. %d \n",n+1);printf("Please put in month: \n");gets(numstr);zg[n].month=atoi(numstr);printf("Please put in zhigongbianhao: \n"); gets(numstr);zg[n].id=atof(numstr);printf("Please put in jibengongzi: \n"); gets(numstr);zg[n].jbgz=atof(numstr);printf("Please put in jintie: \n");gets(numstr);zg[n].jt=atof(numstr);printf("Please put in gangtie: \n");gets(numstr);zg[n].gt=atof(numstr);printf("Please put in butie: \n");gets(numstr);zg[n].bt=atof(numstr);printf("Please put in fangtie: \n");gets(numstr);zg[n].ft=atof(numstr);printf("Please put in jiaotongbutie: \n");gets(numstr);zg[n].jtbt=atof(numstr);zg[n].yfs=(zg[n].jbgz)+(zg[n].jt)+(zg[n].gt)+(zg[n].bt)+(zg[n].ft)+(zg[n].jtbt) ;printf("Please put in fangzu: \n");gets(numstr);zg[n].fz=atof(numstr);printf("Please put in chuxu: \n");gets(numstr);zg[n].cx=atof(numstr);printf("Please put in huifei: \n");gets(numstr);zg[n].hf=atof(numstr);zg[n].grsds=tgrsds(zg[n].yfs);zg[n].yks=(zg[n].fz)+(zg[n].cx)+(zg[n].hf)+(zg[n].grsds); zg[n].sfs=(zg[n].yfs)-(zg[n].yks);n++;}/*删除个人纪录*/delone(void){struct zhigong tmp[50];float zhigongid;int j,k;int flagfind;flagfind=0;k=0;printf("\n Please put in zhigongbianhao: \n");gets(numstr);zhigongid=atof(numstr);for(j=0;j<=n;j++){if(zg[j].id==zhigongid){flagfind=1;}else{tmp[k]=zg[j];k++;}}if(flagfind==1){for(j=0;j<=(n-1);j++){zg[j]=tmp[j];}printf("\n Record deleted! \n");n=n-1;}else{printf("\n Record not found! \n");}return;}/*修改个人纪录*/modone(void){float zhigongid;int j;int flagfind;flagfind=0;printf("\n Please put in zhigongbianhao: \n"); gets(numstr);zhigongid=atof(numstr);for(j=0;j<=n;j++){if(zg[j].id==zhigongid){printf("NO.:%d\n",j);printf("month:%d\n",zg[j].month);printf("zhigongbianhao%10.0f\n",zg[j].id);printf("jibengongzi:%10.2f\n",zg[j].jbgz);printf("Please put in jibengongzi: \n");gets(numstr);zg[j].jbgz=atof(numstr);printf("jintie:%10.2f\n",zg[j].jt);printf("Please put in jintie: \n");gets(numstr);zg[j].jt=atof(numstr);printf("gangtie:%10.2f\n",zg[j].gt);printf("Please put in gangtie: \n");gets(numstr);zg[j].gt=atof(numstr);printf("butie:%10.2f\n",zg[j].bt);printf("Please put in butie: \n");gets(numstr);zg[j].bt=atof(numstr);printf("fangtie:%10.2f\n",zg[j].ft);printf("Please put in fangtie: \n");gets(numstr);zg[j].ft=atof(numstr);printf("jiaotongbutie:%10.2f\n",zg[j].jtbt);printf("Please put in jiaotongbutie: \n");gets(numstr);zg[j].jtbt=atof(numstr);zg[j].yfs=(zg[j].jbgz)+(zg[j].jt)+(zg[j].gt)+(zg[j].bt)+(zg[j].ft) +(zg[j].jtbt);printf("fangzu:%10.2f\n",zg[j].fz);printf("Please put in fangzu: \n");gets(numstr);zg[j].fz=atof(numstr);printf("chuxu:%10.2f\n",zg[j].cx);printf("Please put in chuxu: \n");gets(numstr);zg[j].cx=atof(numstr);printf("huifei:%10.2f\n",zg[j].hf);printf("Please put in huifei: \n");gets(numstr);zg[j].hf=atof(numstr);zg[j].grsds=tgrsds(zg[j].yfs);zg[j].yks=(zg[j].fz)+(zg[j].cx)+(zg[j].hf)+(zg[j].grsds);zg[j].sfs=(zg[j].yfs)-(zg[j].yks);flagfind=1;}else{flagfind=0;}}if(flagfind==0)printf("\n Can not find record! \n");return;}/*随机从内存中查找纪录根据id*/idone(void){float zhigongid;int j;int flagfind;flagfind=0;printf("\n Please put in zhigongbianhao: \n");gets(numstr);zhigongid=atof(numstr);for(j=0;j<=n;j++){if(zg[j].id==zhigongid){printf("\n %d record found! \n |",j+1);printf("month:%d |",zg[j].month);printf("zhigongbianhao%10.0f |",zg[j].id);printf("jibengongzi:%10.2f |",zg[j].jbgz);printf("jintie:%10.2f |",zg[j].jt);printf("gangtie:%10.2f |",zg[j].gt);printf("butie:%10.2f |",zg[j].bt);printf("fangtie:%10.2f |",zg[j].ft);printf("jiaotongbutie:%10.2f |",zg[j].jtbt);printf("yingfashu:%10.2f |",zg[j].yfs);printf("fangzu:%10.2f |",zg[j].fz);printf("chuxu:%10.2f |",zg[j].cx);printf("huifei:%10.2f |",zg[j].hf);printf("gerensuodeshui:%10.2f |",zg[j].grsds);printf("yingkoushu:%10.2f |",zg[j].yks);printf("shifashu:%10.2f\n",zg[j].sfs);flagfind=1;}else{flagfind=0;}}if(flagfind==0)printf("\n Can not find record! \n");return;}/* 输出当月全体职工的工资信息 */listall(void){int j;if(n<1){printf("\n No record! \n");}else{for(j=0;j<n;j++){printf("\n NO:%d |",j+1);printf("month:%d |",zg[j].month);printf("zhigongbianhao%10.0f |",zg[j].id);printf("jibengongzi:%10.2f |",zg[j].jbgz);printf("jintie:%10.2f |",zg[j].jt);printf("gangtie:%10.2f |",zg[j].gt);printf("butie:%10.2f |",zg[j].bt);printf("fangtie:%10.2f |",zg[j].ft);printf("jiaotongbutie:%10.2f |",zg[j].jtbt);printf("yingfashu:%10.2f |",zg[j].yfs);printf("fangzu:%10.2f |",zg[j].fz);printf("chuxu:%10.2f |",zg[j].cx);printf("huifei:%10.2f |",zg[j].hf);printf("gerensuodeshui:%10.2f |",zg[j].grsds);printf("yingkoushu:%10.2f |",zg[j].yks);printf("shifashu:%10.2f\n",zg[j].sfs);}}}/* 把所有纪录从内存中写到磁盘gongzi.rec中 */wfile(void){FILE *fptr;printf("\n Saving date... \n");if(n<1){printf("\n No record! \n");return;}if((fptr=fopen("gongzi.rec","wb"))==NULL)printf("Can not open file gongzi.rec! \n"); else{fwrite(zg,sizeof(zg[0]),n,fptr);fclose(fptr);printf("File of %d records written! \n",n ); }}/* 把所有纪录从磁盘gongzi.rec读到数组gz中 */rfile(void){FILE *fptr;n=0;printf("\n Loading date... \n");if((fptr=fopen("gongzi.rec","rb"))==NULL) printf("Can not open file gongzi.rec! \n"); else{while(fread(&zg[n],sizeof(zg[n]),1,fptr)==1) n++;fclose(fptr);printf(" Total %d records read! \n",n);}}。
C语言课程设计工资管理系统

界面布局:检查界面布局是否合理,是否符合用户习惯 功能测试:测试各个功能模块是否正常工作,是否有错误提示 性能测试:测试系统的响应速度和稳定性,是否有卡顿现象
兼容性测试:测试系统在不同操作系统和浏览器上的兼容性,是否有显示异常
员工信息录入:包括姓名、性别、年龄、 职位、薪资等信息
员工信息删除:删除不再需要的员工信 息
测试目的:验 证系统功能是 否符合设计要
求
测试内容:功 能测试、性能 测试、安全性
测试等
测试方法:黑 盒测试、白盒 测试、灰盒测
试等
测试结果:列 出测试过程中 发现的问题及
解决方案
测试结论:对 系统的整体性 能和稳定性进
行评估
测试建议:针 对测试中发现 的问题提出改
进建议
硬件要求:服务器、网络设备、存 储设备等
部署步骤:安装操作系统、安装数 据库管理系统、安装Web服务器、 部署工资管理系统等
添加标题
添加标题
添加标题
添加标题
软件要求:操作系统、数据库管理 系统、Web服务器等
维护方案:定期备份数据、定期检 查系统运行情况、定期更新系统软 件等
系统运行环境:Windows、Linux等操作系统 硬件要求:CPU、内存、硬盘等 软件安装:安装C语言编译器、数据库管理系统等 系统维护:定期备份数据、更新软件、修复漏洞等
升级方式:自动升级或手动升级 升级内容:功能升级、性能升级、安全升级等 扩展方式:插件扩展、模块扩展、功能扩展等 扩展内容:增加新功能、优化性能、提高安全性等
汇报人:
排序算法:快速排序、归并排序、 堆排序等
图算法:最短路径、最小生成树等
添加标题
添加标题
添加标题
添加标题
c语言职工工资管理系统代码

c语言职工工资管理系统代码随着社会的发展和经济的进步,职工工资管理成为了企业管理中的重要一环。
为了提高工资管理的效率和准确性,许多企业开始采用计算机软件来进行工资管理。
本文将介绍一个基于C语言的职工工资管理系统代码。
首先,我们需要定义一些基本的数据结构和变量。
在这个系统中,我们需要记录每个职工的姓名、工号、基本工资、津贴、扣款等信息。
我们可以使用结构体来定义这些信息,例如:```cstruct Employee {char name[20];int id;float basicSalary;float allowance;float deduction;};```接下来,我们可以定义一些函数来实现不同的功能。
例如,我们可以编写一个函数来添加新的职工信息:```cvoid addEmployee(struct Employee *employees, int *count) { printf("请输入职工姓名:");scanf("%s", employees[*count].name);printf("请输入职工工号:");scanf("%d", &employees[*count].id);printf("请输入职工基本工资:");scanf("%f", &employees[*count].basicSalary);printf("请输入职工津贴:");scanf("%f", &employees[*count].allowance);printf("请输入职工扣款:");scanf("%f", &employees[*count].deduction);(*count)++;}```我们还可以编写一个函数来计算每个职工的实际工资:```cfloat calculateSalary(struct Employee employee) {return employee.basicSalary + employee.allowance - employee.deduction;}```接下来,我们可以编写一个函数来显示所有职工的信息和实际工资:```cvoid displayEmployees(struct Employee *employees, int count) {printf("姓名\t工号\t基本工资\t津贴\t扣款\t实际工资\n");for (int i = 0; i < count; i++) {printf("%s\t%d\t%.2f\t\t%.2f\t%.2f\t%.2f\n", employees[i].name, employees[i].id, employees[i].basicSalary, employees[i].allowance, employees[i].deduction, calculateSalary(employees[i]));}}```最后,我们可以编写一个主函数来实现整个系统的流程:```cint main() {struct Employee employees[100];int count = 0;int choice;do {printf("请选择操作:\n");printf("1. 添加职工信息\n");printf("2. 显示职工信息\n");printf("3. 退出\n");scanf("%d", &choice);switch (choice) {case 1:addEmployee(employees, &count);break;case 2:displayEmployees(employees, count);break;case 3:printf("感谢使用职工工资管理系统!\n"); break;default:printf("无效的选择,请重新输入!\n");break;}} while (choice != 3);return 0;}```通过以上代码,我们可以实现一个简单的职工工资管理系统。
职工工资管理系统c语言程序设计

职工工资管理系统 C 语言程序设计简介职工工资管理系统是一个用于帮助企业管理职工工资的程序,它可以实现对职工的基本信息、工作时长、工资等进行管理。
本文将介绍如何使用 C 语言实现一个简单的职工工资管理系统。
功能设计1. 添加职工信息系统可以添加新的职工信息,包括职工编号、姓名、性别、职位等。
2. 修改职工信息已有职工信息可以进行修改,如姓名、性别、职位等。
3. 计算工资系统可以根据职工的工作时长和基础工资计算出实际工资。
4. 查询职工信息可以通过职工编号或姓名查询职工的详细信息。
5. 显示所有职工信息将所有职工的信息显示在界面上。
开发流程1. 定义数据结构首先,我们需要定义一个数据结构Employee来保存职工的信息,包括职工编号、姓名、性别、职位、基础工资等字段。
struct Employee {int id;char name[50];char gender[10];char position[50];float baseSalary;float hoursWorked;float totalSalary;};2. 编写主要函数添加职工信息void addEmployee(struct Employee emp) {// 将 emp 添加到员工列表中}修改职工信息void updateEmployee(struct Employee emp) {// 根据职工编号修改对应的员工信息}计算工资float calculateSalary(struct Employee emp) {// 计算职工的实际工资return emp.baseSalary + emp.hoursWorked * hourlyRate;}查询职工信息void searchEmployee(int id) {// 根据职工编号查询职工信息}显示所有职工信息void displayAllEmployees() {// 显示所有职工的信息}3. 用户界面交互为了方便用户操作,可以设计一个简单的用户界面,使用控制台打印实现信息展示和输入。
c语言职工工资管理系统代码

C语言职工工资管理系统代码1. 项目简介本项目是一个用C语言编写的职工工资管理系统。
该系统旨在帮助企业或组织更好地管理职工的工资信息,包括薪资计算、数据存储和查询等功能。
通过该系统,可以提高工资管理的效率和准确性,减少人力资源部门的负担。
2. 功能需求本系统需要实现以下功能:•添加新员工:输入员工姓名、基本工资、津贴等信息,并生成唯一的员工ID。
•删除员工:根据员工ID删除指定员工信息。
•修改员工信息:根据员工ID修改指定员工的基本信息。
•计算薪资:根据员工ID计算指定员工的实际薪资,并将结果保存到数据库中。
•查询薪资:根据员工ID查询指定员工的薪资信息。
3. 数据结构设计为了存储职工的基本信息和薪资数据,我们可以使用以下数据结构:3.1 员工结构体定义struct Employee {int id; // 员工IDchar name[50]; // 员工姓名float basicSalary; // 基本工资float allowance; // 津贴float actualSalary; // 实际薪资};3.2 员工数组定义struct Employee employees[100]; // 最多存储100个员工的信息int employeeCount = 0; // 当前员工数量4. 系统实现4.1 添加新员工void addEmployee() {struct Employee employee;printf("请输入员工姓名:");scanf("%s", );printf("请输入基本工资:");scanf("%f", &employee.basicSalary);printf("请输入津贴:");scanf("%f", &employee.allowance);employee.id = employeeCount + 1;employee.actualSalary = employee.basicSalary + employee.allowance;employees[employeeCount] = employee;employeeCount++;printf("添加成功!员工ID为:%d\n", employee.id);}4.2 删除员工void deleteEmployee() {int id;printf("请输入要删除的员工ID:");scanf("%d", &id);int index = findEmployeeIndex(id);if (index == -1) {printf("未找到对应的员工信息。
C语言 员工工资管理系统 codeblocks

记得自己创建一个名字为“employee data”的空白文件哦!!,然后放到新建的codeblocks 文件夹里面#include<stdio.h>#include<windows.h>#include<string.h>#include<conio.h>FILE*fp;void welcome();void search();void add();int login();void menu1();void menu2();void enroll(int);void changeword(int);void output();void input();void delete1();int load();void save(int);void xiugai();struct nameandword{char username[30]; //保存用户名char password[30]; //保存密码char newpassword[30];//保存新密码}a[10]={"manager","123","123"};struct employee{char num[10]; //职工工号char name[15]; //职工姓名float jbgz; //职工基本工资float jj; //职工奖金float kk; //职工扣款float sk; //职工税款float sfgz; //职工实发工资}b[100],b1[100];int main(){system("color 4E");int n,j,button;welcome();getchar();logo1:(j=login());if(j==0){logo4:menu1();do{printf("功能选择(1--9):");scanf("%d",&n);if(n>=1&&n<=9){button=1;break;}else{button=0;printf("您输入有误,请重新选择!\n");}}while(button==0);switch(n){case 1:system("cls");input();goto logo4;case 2:system("cls");output();goto logo4;case 3:system("cls");search();goto logo4;case 4:system("cls");add();goto logo4;case 5:system("cls");xiugai();goto logo4;case 6:system("cls");delete1();goto logo4;case 7:system("cls");changeword(j);goto logo4;case 8:system("cls");enroll(j);goto logo4;case 9:goto logo1;break;default:printf("功能暂无");}return 0;}else{logo5:menu2();do{printf("功能选择(1--3):");scanf("%d",&n);if(n>=1&&n<=3){button=1;break;}else{button=0;printf("您输入有误,请重新选择!\n");}}while(button==0);switch(n){case 1:system("cls");output();goto logo5;case 2:system("cls");changeword(j);goto logo5;case 3:goto logo1;break;default:printf("功能暂无");break;}return 0;}}void welcome() //欢迎界面{system("cls");system("color F9");printf("\n\n\n\n\n\n");printf("************************************************************************* *******");printf("*****************************欢迎使用工资管理系统*****************************");printf("************************************************************************* *********\n\n\n\n\n");printf("\t\t制作人: ");printf("黑狼\n\n\n\n\n\n");printf("\t\t\t ***按任意键进入***");}void menu1() //管理员菜单界面{system("cls");system("color 3B");printf("***菜单***\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 1 输入\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 2 显示\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 3 查找\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 4 添加\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 5 修改\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 6 删除\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 7 修改密码\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 8 注册员工账号\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 9 退出\n\n");printf("说明:1.如首次使用尚未输入数据请先输入数据\n 2.输入的数据将自动保存\n 3.再次选择输入功能时原数据将被覆盖\n\n");}void menu2() //员工菜单界面{system("cls");system("color 3B");printf("***菜单***\n\n");printf("\n\n\n\n>>>>>>>>>>>>>>>>>>>>>>>>> 1 显示\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 2 修改密码\n\n");printf(">>>>>>>>>>>>>>>>>>>>>>>>> 3 退出\n\n");}int login()//登陆界面{system("cls");system("color 80");char username[30]; //保存用户名char password[30]; //保存密码int i,count=0;printf("\n\t\t\t%c*******************************%c\n",1,1);printf("\t\t\t%c 1.以管理员身份进入系统\t%c",1,1);printf("\t\t\t\t\t\t%c\t\t\t\t%c\n",1,1);printf("\t\t\t%c 2.以员工身份进入系统\t%c\n\t\t\t",1,1);printf("%c\t\t\t\t%c",1,1);printf("\n\t\t\t%c*******************************%c\n\n\n",1,1);logo:printf("\n\t\t\t请输入账号:");//管理员账号:managerscanf("%s",username);printf("\t\t\t密码:");//密码:123scanf("%s",password);for(i=1;i<10;i++){if(strcmp(username,a[i].username)==0&&strcmp(password,a[i].password) == 0)return i;}if(strcmp(username,a[0].username)==0&&strcmp(password,a[0].password) == 0)return 0;else{printf("\t\t对不起,您输入的用户名或密码错误!");count++;if(count>=3){system("cls");printf("\n\n\n\n\n\t\t 提示:您输入错误的次数太多,请稍后再试!\n");exit(0);}goto logo;}return 0;}void enroll(j)//注册员工账号{int m;j++;logo2:printf("\n\n\n\n\t\t\t**********************************\n");printf("\t\t\t\t请输入用户名:");scanf("%s",a[j].username);getchar();printf("\t\t\t**********************************\n");printf("\t\t\t\t请输入密码:");scanf("%s",a[j].password);getchar();printf("\t\t\t**********************************\n");printf("\t\t\t\t请再次输入密码:");scanf("%s",a[j].newpassword);getchar();printf("\t\t\t**********************************\n");if(strcmp(a[j].password,a[j].newpassword)==0){printf("\t\t\t\t注册成功\n");printf("\t\t\t**********************************\n");}else{printf("\t\t\t\t注册失败\n");printf("\t\t\t**********************************\n");}printf("\n\t\t\t1.继续注册员工账号。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
/*程序名称:工资管理系统 *//*程序说明:该系统在磁盘上储存了某单位上月全体员工的工资信息,对于每一位职工存储以下信息:月份,职工编号,基本工资,津贴,岗贴,补贴,房贴,交通补贴,应发数,房租,储蓄,会费,个人所得税,应扣数,实发数。
个人所得税计算方法设定为:工资少于800元为0,800-1000元的部分为5%,1000-5000元的部分为10%,5000元以上的部分为20%。
该系统功能如下:1)创建存储职工工资信息的存储系统。
2)添加职工的工资信息(增加新职工时用)3)删除某职工的工资信息(职工离职或者死亡时用)4)修改某职工的部分工资信息(当月开始增加或减少某些项工资或扣款数变化)5)输出指定编号职工的工资信息(查询用)6)输出当月全体职工的工资信息(发工资用) *//*编写心得:2006年9月26日19:30-23:00共计3小时30分钟。
由于时间仓促,没有对代码进行优化设计。
对于主要的结构体也是粗粗设计了一下。
在存储上只采用了结构体数组,没用运用到二叉树等复杂的数据结构,有点遗憾。
主程序采用模块化设计,用独立的函数把功能分解开来,便于调试和扩展。
假如用C++就可以多做几个构造函数,可能会更方便点。
不过最近在学JAVA,不敢乱用C++了,怕到时候知识搞混了。
感觉稍微麻烦一点的地方是文件的输入输出部分,因为一般的书上这一章都比较靠后,老师上课也就简单的带过的,格式有点忘记了。
个人感觉现在靠C语言来做数据库不是很合适,50个元素的数组应该够了吧。
反正只要弄清那些常用函数,还有怎么一个I/O方式就可以了。
让偶想起了教偶C语言的班主任老童,想起了偶美好的青春,以及那些为了听课和MM们一大早抢前排坐位的幸福日子...总得来说还是比较轻松的,就是项目字段太多,写写麻烦(谁叫偶打字不快啊^_^)BY 雨田心梦*//* 为了调用FILE等函数 */ #include "stdio.h"#include "conio.h"/* 为了调用atof()等函数 */ #include "stdlib.h"#define TRUE 1/* 结构体声明 */struct zhigong{int month;float id;float jbgz;float jt;float gt;float bt;float ft;float jtbt;float yfs;float fz;float cx;float hf;float grsds;float yks;float sfs;};/* 建立50个元素的结构体数组 */ struct zhigong zg[50];/* 建立结构体变量 */struct zhigong zgone;/* 职员列表中的数量 */int n=0;/* 获得字符串 */char numstr[50];main(){char ch;n=0;/*rfile(); 使用后启动程序时系统会自动加载纪录*/while(TRUE){printf("\n");printf("========================================= ==\n");printf("Welcome!Pleasechoice(1-6) : +\n");printf("1.Add oneinfomation +\n");printf("2.Delete oneinfomation +\n");printf("3.Modify oneinfomation +\n");printf("4.Print out byid +\n");printf("5.Print outall +\n ");printf("6.Savedate+\n");printf("7.Loaddate+\n");printf("8.Exit+\n");printf("========================================= ==\n");ch=getche();switch(ch){case '1':addone();break;case '2':delone();break;case '3':modone();break;case '4':idone();break;case '5':listall();break;case '6':wfile();break;case '7':rfile();break;case '8':return;default:printf("Sorry,please choice again!\n");}}}/*计算个人所得税*/float tgrsds(float m){float sui1,sui2,sui3;float tmp;sui1=0;sui2=0;sui3=0;if(m>=5000){sui1=(m-5000)*0.2;sui2=(5000-1000)*0.1; sui3=(1000-800)*0.05; }else if(m>=1000 && m<5000) {sui2=(m-1000)*0.1;sui3=(1000-800)*0.05; }else if(m>=800 && m<1000) {sui3=(m-800)*0.05;}tmp=sui1+sui2+sui3;return(tmp);}/* 添加职工的工资信息 */addone(void){printf("\n");printf("Record NO. %d \n",n+1);printf("Please put in month: \n");gets(numstr);zg[n].month=atoi(numstr);printf("Please put in zhigongbianhao: \n"); gets(numstr);zg[n].id=atof(numstr);printf("Please put in jibengongzi: \n"); gets(numstr);zg[n].jbgz=atof(numstr);printf("Please put in jintie: \n");gets(numstr);zg[n].jt=atof(numstr);printf("Please put in gangtie: \n");gets(numstr);zg[n].gt=atof(numstr);printf("Please put in butie: \n");gets(numstr);zg[n].bt=atof(numstr);printf("Please put in fangtie: \n");gets(numstr);zg[n].ft=atof(numstr);printf("Please put in jiaotongbutie: \n");gets(numstr);zg[n].jtbt=atof(numstr);zg[n].yfs=(zg[n].jbgz)+(zg[n].jt)+(zg[n].gt)+(zg[n].bt)+(z g[n].ft)+(zg[n].jtbt);printf("Please put in fangzu: \n");gets(numstr);zg[n].fz=atof(numstr);printf("Please put in chuxu: \n");gets(numstr);zg[n].cx=atof(numstr);printf("Please put in huifei: \n");gets(numstr);zg[n].hf=atof(numstr);zg[n].grsds=tgrsds(zg[n].yfs);zg[n].yks=(zg[n].fz)+(zg[n].cx)+(zg[n].hf)+(zg[n].grsds); zg[n].sfs=(zg[n].yfs)-(zg[n].yks);n++;}/*删除个人纪录*/delone(void){struct zhigong tmp[50];float zhigongid;int j,k;int flagfind;flagfind=0;k=0;printf("\n Please put in zhigongbianhao: \n"); gets(numstr);zhigongid=atof(numstr);for(j=0;j<=n;j++){if(zg[j].id==zhigongid){flagfind=1;}else{tmp[k]=zg[j];k++;}}if(flagfind==1){for(j=0;j<=(n-1);j++){zg[j]=tmp[j];}printf("\n Record deleted! \n");n=n-1;}else{printf("\n Record not found! \n");}return;}/*修改个人纪录*/modone(void){float zhigongid;int j;int flagfind;flagfind=0;printf("\n Please put in zhigongbianhao: \n"); gets(numstr);zhigongid=atof(numstr);for(j=0;j<=n;j++){if(zg[j].id==zhigongid){printf("NO.:%d\n",j);printf("month:%d\n",zg[j].month);printf("zhigongbianhao%10.0f\n",zg[j].id); printf("jibengongzi:%10.2f\n",zg[j].jbgz); printf("Please put in jibengongzi: \n"); gets(numstr);zg[j].jbgz=atof(numstr);printf("jintie:%10.2f\n",zg[j].jt);printf("Please put in jintie: \n");gets(numstr);zg[j].jt=atof(numstr);printf("gangtie:%10.2f\n",zg[j].gt);printf("Please put in gangtie: \n");gets(numstr);zg[j].gt=atof(numstr);printf("butie:%10.2f\n",zg[j].bt);printf("Please put in butie: \n");gets(numstr);zg[j].bt=atof(numstr);printf("fangtie:%10.2f\n",zg[j].ft);printf("Please put in fangtie: \n");gets(numstr);zg[j].ft=atof(numstr);printf("jiaotongbutie:%10.2f\n",zg[j].jtbt);printf("Please put in jiaotongbutie: \n");gets(numstr);zg[j].jtbt=atof(numstr);zg[j].yfs=(zg[j].jbgz)+(zg[j].jt)+(zg[j].gt)+ (zg[j].bt)+(zg[j].ft)+(zg[j].jtbt);printf("fangzu:%10.2f\n",zg[j].fz);printf("Please put in fangzu: \n");gets(numstr);zg[j].fz=atof(numstr);printf("chuxu:%10.2f\n",zg[j].cx);printf("Please put in chuxu: \n");gets(numstr);zg[j].cx=atof(numstr);printf("huifei:%10.2f\n",zg[j].hf);printf("Please put in huifei: \n");gets(numstr);zg[j].hf=atof(numstr);zg[j].grsds=tgrsds(zg[j].yfs);zg[j].yks=(zg[j].fz)+(zg[j].cx)+(zg[j].hf)+(z g[j].grsds);zg[j].sfs=(zg[j].yfs)-(zg[j].yks);flagfind=1;}else{flagfind=0;}}if(flagfind==0)printf("\n Can not find record! \n");return;}/*随机从内存中查找纪录根据id*/idone(void){float zhigongid;int j;int flagfind;flagfind=0;printf("\n Please put in zhigongbianhao: \n");gets(numstr);zhigongid=atof(numstr);for(j=0;j<=n;j++){if(zg[j].id==zhigongid){printf("\n %d record found! \n |",j+1);printf("month:%d |",zg[j].month);printf("zhigongbianhao%10.0f |",zg[j].id);printf("jibengongzi:%10.2f |",zg[j].jbgz);printf("jintie:%10.2f |",zg[j].jt);printf("gangtie:%10.2f |",zg[j].gt);printf("butie:%10.2f |",zg[j].bt);printf("fangtie:%10.2f |",zg[j].ft);printf("jiaotongbutie:%10.2f |",zg[j].jtbt);printf("yingfashu:%10.2f |",zg[j].yfs);printf("fangzu:%10.2f |",zg[j].fz);printf("chuxu:%10.2f |",zg[j].cx);printf("huifei:%10.2f |",zg[j].hf);printf("gerensuodeshui:%10.2f |",zg[j].grsds);printf("yingkoushu:%10.2f |",zg[j].yks);printf("shifashu:%10.2f\n",zg[j].sfs);flagfind=1;}else{flagfind=0;}}if(flagfind==0)printf("\n Can not find record! \n");return;}/* 输出当月全体职工的工资信息 */listall(void){int j;if(n<1){printf("\n No record! \n");}else{for(j=0;j<n;j++){printf("\n NO:%d |",j+1);printf("month:%d |",zg[j].month);printf("zhigongbianhao%10.0f |",zg[j].id);printf("jibengongzi:%10.2f |",zg[j].jbgz);printf("jintie:%10.2f |",zg[j].jt);printf("gangtie:%10.2f |",zg[j].gt);printf("butie:%10.2f |",zg[j].bt);printf("fangtie:%10.2f |",zg[j].ft);printf("jiaotongbutie:%10.2f |",zg[j].jtbt);printf("yingfashu:%10.2f |",zg[j].yfs);printf("fangzu:%10.2f |",zg[j].fz);printf("chuxu:%10.2f |",zg[j].cx);printf("huifei:%10.2f |",zg[j].hf);printf("gerensuodeshui:%10.2f |",zg[j].grsds);printf("yingkoushu:%10.2f |",zg[j].yks);printf("shifashu:%10.2f\n",zg[j].sfs);}}}/* 把所有纪录从内存中写到磁盘gongzi.rec中 */wfile(void){FILE *fptr;printf("\n Saving date... \n");if(n<1){printf("\n No record! \n");return;}if((fptr=fopen("gongzi.rec","wb"))==NULL)printf("Can not open file gongzi.rec! \n"); else{fwrite(zg,sizeof(zg[0]),n,fptr);fclose(fptr);printf("File of %d records written! \n",n ); }}/* 把所有纪录从磁盘gongzi.rec读到数组gz中 */rfile(void){FILE *fptr;n=0;printf("\n Loading date... \n");if((fptr=fopen("gongzi.rec","rb"))==NULL) printf("Can not open file gongzi.rec! \n"); else{while(fread(&zg[n],sizeof(zg[n]),1,fptr)==1) n++;fclose(fptr);printf(" Total %d records read! \n",n);}}。