C语言-课程设计-教师工资管理系统(职工工资管理系统)

合集下载

C-教师工资管理系统(分析-代码)-PPT课件

C-教师工资管理系统(分析-代码)-PPT课件

void Output(ofstream& ofs) { ofs<<No<<" "<<Name<<" "<<Duty<<" "<<Hours<<endl; }
double Incoming() { return Salary+(Hours-120)*20; } };
class Assistant:virtual public Person //实验员 { protected: int Allowance; int Hours;
<<CppFriend>>
Person
#No: int #Name: char #Duty: char #Salary: double #next: Person
<<create>>-Person() <<destroy>>-Person()
+Input(): void +Input(ifs: ifstream): void +Output(): void +Output(ofs: ofstream): void +Incoming(): double
Assistant
#Allowance: int #Hours: int
<<create>>-Assistant() +Input(): void +Input(ifs: ifstream): void +Output(): void +Output(ofs: ofstream): void +Incoming(): double

c语言程序设计课程设计选题 (1)

c语言程序设计课程设计选题 (1)

《C语言程序设计》课程设计课题表一、A类1.职工信息管理系统设计2.职工信息包括职工号、姓名、性别、年龄、学历、工资、住址、电话等(职工号不重复)。

试设计一职工信息管理系统,使之能提供以下功能:3.1、职工信息录入功能(职工信息用文件保存)--输入4.2、职工信息浏览功能--输出5.3、职工信息查询功能--算法6.查询方式:按学历查询、按职工号查询、条件组合查询7.职工信息删除、修改功能(可选项)8.图书信息管理系统设计9.图书信息包括:登录号、书名、作者名、分类号、出版单位、出版时间、价格等。

10.试设计一图书信息管理系统,使之能提供以下功能:11.1、图书信息录入功能(图书信息用文件保存)--输入12.2、图书信息浏览功能--输出13.3、图书信息查询功能--算法14.查询方式:按书名查询、按作者名查询、条件组合查询15.图书信息的删除与修改(可选项)16.图书管理系统设计17.图书管理信息包括:图书名称、图书编号、单价、作者、存在状态、借书人姓名、性别、学号等18.功能描述:19.1、新进图书基本信息的输入。

20.2、图书基本信息的查询。

21.3、对撤消图书信息的删除。

22.4、为借书人办理注册。

23.5、办理借书手续。

24.6、办理还书手续25.要求:使用文件方式存储数据。

26.实验设备管理系统设计27.实验设备信息包括:设备编号,设备种类(如:微机、打印机、扫描仪等等),设备名称,设备价格,设备购入日期,是否报废,报废日期等。

28.主要功能:29.1、能够完成对设备的录入和修改30.2、对设备进行分类统计31.3、设备的破损耗费和遗损处理32.4、设备的查询33.要求:使用文件方式存储数据。

34.学生信息管理系统设计35.学生信息包括:学号,姓名,年龄,性别,出生年月,地址,电话,E-mail等。

试设计一学生信息管理系统,使之能提供以下功能:36.1、系统以菜单方式工作37.2、学生信息录入功能(学生信息用文件保存)--输入38.3、学生信息浏览功能--输出39.4、学生信息查询功能--按学号查询、按姓名查询、40.5、学生信息的删除与修改(可选项)41.要求:使用文件方式存储数据。

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语言工资管理系统课程设计

c语言工资管理系统课程设计

c语言工资管理系统课程设计一、课程目标知识目标:1. 让学生掌握C语言中数组、结构体、文件操作等基本知识,并能将其应用于工资管理系统。

2. 使学生了解工资管理系统的基本功能需求,如员工信息录入、查询、修改和删除等。

3. 帮助学生理解工资计算方法,包括基本工资、加班工资、税金和实发工资等。

技能目标:1. 培养学生运用C语言设计、编写和调试工资管理系统的能力。

2. 提高学生分析问题、解决问题的能力,使其能够根据实际需求,优化系统功能。

3. 培养学生团队协作和沟通能力,通过分组完成任务,共同完成课程设计。

情感态度价值观目标:1. 激发学生对计算机编程的兴趣,培养其主动学习和探究的精神。

2. 培养学生认真负责的态度,对待课程设计任务,养成良好的编程习惯。

3. 引导学生关注实际应用,理解计算机技术在企业管理中的重要性,提高职业素养。

分析课程性质、学生特点和教学要求:1. 课程性质:本课程为C语言课程设计,旨在帮助学生将所学知识应用于实际项目中,提高编程能力和解决实际问题的能力。

2. 学生特点:学生已经掌握了C语言的基本知识,具有一定的编程基础,但对实际项目开发尚缺乏经验。

3. 教学要求:结合教材内容,以实用性为导向,注重培养学生的实际操作能力和团队协作能力。

二、教学内容1. 教学大纲:a. C语言数组、结构体和文件操作复习b. 工资管理系统功能需求分析c. 工资计算方法及实现d. 系统设计、编码与调试e. 团队协作与项目展示2. 教学内容安排与进度:a. 第一周:复习C语言数组、结构体和文件操作相关知识,讲解工资管理系统项目背景和功能需求。

b. 第二周:分析工资计算方法,引导学生设计系统功能模块,编写系统设计文档。

c. 第三周:根据设计文档,分组进行编码,实现工资管理系统的基础功能。

d. 第四周:优化系统功能,进行系统调试,确保系统稳定运行。

e. 第五周:团队协作,整理项目文档,准备项目展示。

3. 教材章节与内容:a. 数组、结构体和文件操作:教材第3章、第4章、第6章b. 工资管理系统功能需求分析:教材第10章 实践项目案例c. 工资计算方法及实现:教材第7章 循环与分支结构d. 系统设计、编码与调试:教材第8章 函数与模块化编程e. 团队协作与项目展示:教材第12章 软件工程实践4. 教学内容列举:a. 数组、结构体和文件操作:数组的使用、结构体定义和操作、文件读写。

教师工资管理系统c语言课设报告

教师工资管理系统c语言课设报告

教师工资管理系统c语言课设报告1. 项目背景教师工资管理系统是一种为学校或教育机构管理教师工资的软件系统。

在传统的工资管理方式中,人工计算和记录容易出错,效率低下。

而使用教师工资管理系统,可以提高工资管理的准确性和效率,节省人力成本。

2. 项目目标本项目旨在设计和实现一个简单的教师工资管理系统,具备以下功能:1. 教师信息的录入、修改和删除;2. 工资计算和生成工资单;3. 工资查询和统计。

3. 项目设计3.1 数据结构设计根据教师工资管理系统的需求,在设计数据结构时需要考虑以下几个要素:1. 教师信息:包括教师工号、姓名、性别、职称、基本工资等。

2. 工资单:包括工资单号、发放时间、应发金额、实发金额等。

根据需求,可以设计以下数据结构:ctypedef struct {int teacherId; 教师工号char name[20]; 姓名char gender[5]; 性别char title[20]; 职称float basicSalary; 基本工资} Teacher;typedef struct {int salaryId; 工资单号char distributeTime[20]; 发放时间float shouldPay; 应发金额float actualPay; 实发金额} Salary;3.2 模块划分根据项目目标,可以将教师工资管理系统划分为以下几个模块:1. 教师信息管理模块:实现教师信息的录入、修改和删除功能。

2. 工资管理模块:实现工资计算、生成工资单、工资查询和统计功能。

3. 界面模块:实现系统的交互界面,使用户能够方便地操作系统。

4. 项目实现4.1 教师信息管理模块教师信息管理模块主要包括教师信息的录入、修改和删除功能。

可以使用文件操作来实现数据的存储和读取。

4.2 工资管理模块工资管理模块主要包括工资计算、生成工资单、工资查询和统计功能。

4.2.1 工资计算工资计算是根据教师的基本工资和绩效考核来计算教师的应发金额。

C语言课程设计报告:职工信息管理系统程序设计

C语言课程设计报告:职工信息管理系统程序设计

1.课程论文题目职工信息管理系统程序设计一、题目要求职工信息包括职工号、姓名、性别、年龄、学历、工资、住址、电话等(职工号不重复)。

试设计一职工信息管理系统,使之能提供以下功能:(1)系统以菜单的方式工作。

(2)职工信息录入功能(职工信息用文件保存)。

(3)职工浏览功能。

(4)职工信息查询功能,查询方式可按学历查询或者工号查询。

(5)职工信息的删除、修改功能(可选项)。

2.程序设计思路1、设计思路(1)根据题目要求,应该把职工工资信息用结构体形式输入,在定义一个全局变量和文件指针进行整个程序的运行,然后把职工工资信息送到文件中,所以应该提供一个结构体和文件的输入输出等操作;(2)在程序中需实现职工工资浏览、查询、统计等功能的操作,所以需要建立相应的功能模块来实现;(3)另外还需要提供键盘式选择菜单实现功能,在运行时达到所要的目的。

3.功能模块图5.算法设计1.主函数提供输入、处理和输出部分的函数调用,各功能模块采用菜单方式选择。

2浏览模块【分析】该模块的功能是浏览职工的全部信息3排序模块4查询模块【分析】该模块的功能是根据输入的职工按照工号和学历查找对应的记录,找到以后,可进行继续查找或修改信息的操作。

流程图如下:5修改模块【分析】该模块的功能是显示所有职工的信息,考虑到记录较多,建议采用分屏显示。

显示完所有记录后,输入要修改的职工的工号,根据工号查到职工的记录,并提示用户修改该记录的哪部分信息,根据用户做的选择修改相应信息。

流程图如下:6.程序代码#include<stdio.h>#define N 50struct worker{char id[50];char name[20];char sex[10];char age[10];char edu[20];char salary[10];char address[20];char tel[20];}worker[N];void save(int n) //保存函数,保存n个记录{ FILE *fp;int i;if((fp=fopen("worker.txt","wb"))==NULL) //以只写方式为输出打开一个二进制文件{ printf("\nCannot open file\n");}for(i=0;i<n;i++)if(fwrite(&worker[i],sizeof(struct worker),1,fp)!=1)printf("file write error\n");fclose(fp);}int load() //加载函数{ FILE *fp;int i;if((fp=fopen("worker.txt","rb"))==NULL){printf("\nCannot open file\n");return NULL;}for(i=0;!feof(fp);i++)fread(&worker[i],sizeof(struct worker),1,fp);fclose(fp);return(i-1);}void no_input(int i,int n) //工号输入函数,i表示第i个职工的信息,n 表示比较到第n个职工{ int j,k,w1;do{w1=0;printf("工号:");scanf("%s",worker[i].id);for(j=0;worker[i].id[j]!='\0';j++)if(worker[i].id[j]<'0'||worker[i].id[j]>'9') //判断工号是否为数字{puts("请重新输入!\n");w1=1;break;}if(w1!=1)for(k=0;k<n;k++) //比较到第N个职工if(k!=i&&strcmp(worker[k].id,worker[i].id)==0) //判断职工号是否有雷同{puts("请重新输入!\n");w1=1;break;}}while(w1==1);}void input(int i) //输入一个记录的函数{ no_input(i,i);printf("姓名:");scanf("%s",worker[i].name);printf("性别:");scanf(" %s",&worker[i].sex);printf("年龄:");scanf("%s",&worker[i].age);printf("工资:");scanf("%s",worker[i].salary);printf("学历:");scanf("%s",&worker[i].edu);printf("住址:");scanf("%s",worker[i].address);printf("电话:");scanf("%s",worker[i].tel);}void printf_one(int i) //显示一个记录的函数{printf("%10s %10s %5s %5s %8s %6s %10s %10s\n",worker[i].id,worker[i].name,worker[i].sex,worker[i].age,worker[i].salary,worker[i].edu,worker[i].address,worker[i].tel); }void printf_back() //一个任务结束后选择是好似浏览还是返回{ int k,w;printf("\n\n\tSuccessful^-^.\n\n");printf("接下来做什么?\n\n\t1).浏览全部\t2).返回: [ ]\b\b");scanf("%d",&w);if(w==1)browse();else menu();}modify_data(int i,int n) //修改函数{ int c,w1;do{puts("\nmodify by=>\n\n 1).工号 2).姓名 3).性别 4).年龄 5).工资6).学历 7).地址 8).电话 9).取消");printf("请选择?:[ ]\b\b");scanf("%d",&c);if(c>9||c<1){puts("\nChoice error!please again!");getchar();}}while(c>9||c<1);do{switch(c){case 1:no_input(i,n);break;case 2:printf("name:");scanf("%s",worker[i].name);break;case 3:printf("sex:");scanf("%s",worker[i].sex);break;case 4:printf("age:");scanf("%s",worker[i].age);break;case 5:printf("salary:");scanf("%s",worker[i].salary);break;case 6:printf("edu:");scanf("%s",worker[i].edu);break;case 7:printf("address:");scanf("%s",worker[i].address);break;case 8:printf("tel:");scanf("%s",worker[i].tel);break;case 9:menu();break;}puts("\nNow:\n");printf_face();printf_one(i);printf("\n确定?\n\n\t1).是2).否,重新修改3).不保存退出[ ]\b\b");scanf("%d",&w1);if(w1==1)save(n);}while(w1==2);return(w1);}printf_face() //显示数据结构项目{ printf("\n\t工号姓名性别年龄工资学历地址电话号码\n"); }void enter() //输入模块{ int i,n;printf("输入多少个职工信息(0-%d):",N-1);scanf("%d",&n);printf("\n 请输入职工信息\n\n");for(i=0;i<n;i++)input(i);if(i!=0)save(n);printf_back();}browse() //浏览模块{ int i,j,n;n=load();printf_face();for(i=0;i<n;i++){if((i!=0)&&(i%10==0)){printf("\n\n按任意键显示下一页...");getch();puts("\n\n");}printf_one(i);}printf("\t这里有 %d 条记录.\n",n);printf("\n按任意键返回...");getch();menu();}modify() //修改模块{struct worker s;FILE *fp;int i,n,k,w0=1,w1,w2=0;n=load();do{k=-1;printf_face();for(i=0;i<n;i++){if((i!=0)&&(i%10==0)) //目的是分屏显示{printf("\n\n记住要修改的工号.按任意键显示下一页");getch();puts("\n\n");}printf_one(i); //调用显示一个记录的函数}do{printf("\n\n输入要修改的职工工号! 工号:");scanf("%s",s.id); //输入要修改的IDfor(i=0;i<n;i++) //查找要修改的数据if(strcmp(s.id,worker[i].id)==0){k=i; //找到要修改的记录s=worker[i]; //把worker[i]备份,以便恢复}if(k==-1)printf("\n\n未找到请重输");}while(k==-1); //当k=-1表示没有找到printf_face(); //调用显示数据结构项目的函数printf_one(k); //调用显示一个记录的函数w1=modify_data(k,n); //修改记录并返回保存控制值w1,w1=1表示用户已确认修改if(w1==1){printf("\Successful^_^.\n\n修改另一个?\n\n\t1).是 2).否,保存退出\t[ ]\b\b");scanf("%d",&w0);w2=1; //用来控制保存,使w2=1是标记已有过修改}else{w0=0;if(w2==1)worker[k]=s;}if(w0!=1&&w2==1)save(n);}while(w0==1);menu();}search() //查询模块{ int c,w1;do{puts("\nsearch by=>\n\n1).工号 2}.学历 3).取消并返回"); printf("Which you needed?:[ ]\b\b");scanf("%d",&c);if(c>3||c<1){ puts("\nchoice error!please again!");getchar();}}while(c>3||c<1);{switch(c){case 1:search1();break;case 2:search2();break;case 3:menu();break;}}}search1() //按工号查询模块{int i,n,k,w1=1,w2,w3,w4;struct worker s;n=load();do{do{k=-1;printf("\n\n输入要查询的工号! id:");scanf("%s",s.id);printf_face();for(i=0;i<n;i++)if(strcmp(s.id,worker[i].id)==0){k=i;printf_one(k);break;}if(k==-1){printf("\n\nNo exit!please");printf("\n\n继续查找?\n\t1).是 2).否,返回 [ ]\b\b");scanf("%d",&w1);if(w1==2) menu();}}while(k==-1&&w1==1);w4=0;w3=0;if(k!=-1){printf("\n\n接下来干什么?\n\t1).查找另一个 2).修改 3).返回菜单[ ]\b\b");scanf("%d",&w2);switch(w2){case 1:search1();break;case 2:w3=modify_data(k,n);break;case 3:{menu();break;}}}}while(w2==1);menu();}search2() //按学历查询模块{int i,n,k,w1=1,w2,w3,w4;struct worker s;n=load();do{do{k=-1;printf("\n\n请输入你要查询的学历:\n");scanf("%s",);printf_face();for(i=0;i<n;i++)if(strcmp(,worker[i].edu)==0){k=i;printf_one(k);}if(k==-1){printf("\n\nNo exit!please");printf("\n\n继续查找?\n\t1).是 2).否,返回 [ ]\b\b");scanf("%d",&w1);if(w1==2) menu();}}while(k==-1&&w1==1);w4=0;w3=0;if(k!=-1){printf("\n\n接下来干什么?\n\t1).查找另一个 2).修改 3).返回菜单[ ]\b\b");scanf("%d",&w2);switch(w2){case 1:search2();break;case 2:w3=modify_data(k,n);break;case 3:{menu();break;}}}}while(w2==1);menu();}menu(){int n,w1;do{puts("\t\t*******************菜单*******************\n\n");puts("\t\t\t\t1.录入职工信息");puts("\t\t\t\t2.浏览职工信息");puts("\t\t\t\t3.查询职工信息");puts("\t\t\t\t4.修改职工信息");puts("\t\t\t\t5.退出");puts("\t\t****************************************\n\n");printf("请选择(1~5): [ ]\b\b");scanf("%d",&n);if(n<1||n>5) //对选择的数字作判断{w1=1;getchar();}else w1=0;} while(w1==1);switch(n){case 1:enter();break; //录入 case 2:browse();break; //浏览 case 3:search();break; //查询 case 4:modify();break; //修改 case 5:exit(0); //退出}}main(){menu();}7.程序运行结果下面是各个模块的的界面截图(1)、主菜单(2)、输入模块(3)、浏览模块(3)、查找模块(4)、修改模块8.编程中遇到的困难及解决方法温故而知新,可以为师矣。

工资管理系统课程设计C语言

工资管理系统课程设计C语言

工资管理系统 课程设计 C语言一、课程目标知识目标:1. 理解工资管理系统的基本概念和功能需求;2. 掌握C语言中的基本数据类型、运算符、控制结构等编程知识点;3. 学会使用C语言设计并实现一个简单的工资管理系统。

技能目标:1. 能够运用C语言编写出结构清晰、逻辑合理的程序代码;2. 能够运用数组、结构体等数据结构存储和管理工资数据;3. 能够运用文件操作实现工资数据的持久化存储。

情感态度价值观目标:1. 培养学生解决问题的能力和团队协作精神,激发学生对编程的兴趣;2. 增强学生对信息技术的认识,使其意识到信息技术在现实生活中的应用价值;3. 培养学生严谨、认真的学习态度,提高学生的编程素养。

课程性质:本课程为C语言编程实践课,旨在让学生通过动手实践,掌握C语言编程的基本技能,并能够运用所学知识解决实际问题。

学生特点:学生为高年级学生,已具备一定的C语言基础,有较强的逻辑思维能力,但对实际应用场景的编程经验不足。

教学要求:结合学生特点,注重实践操作,引导学生从实际问题出发,逐步培养编程思维,提高编程能力。

课程目标分解为具体学习成果,便于教学设计和评估。

二、教学内容1. 工资管理系统概述- 系统需求分析- 功能模块划分2. C语言基础知识回顾- 数据类型- 运算符与表达式- 控制结构(顺序、分支、循环)3. 数据结构设计- 数组- 结构体4. 函数与模块化编程- 函数定义与调用- 模块化设计5. 文件操作- 文件打开与关闭- 文件读写操作6. 工资管理系统功能实现- 员工信息管理- 工资计算- 工资查询- 数据存储与读取7. 测试与调试- 功能测试- 性能测试- 代码调试教学内容安排与进度:第1周:工资管理系统概述及需求分析第2周:C语言基础知识回顾第3周:数据结构设计第4周:函数与模块化编程第5周:文件操作第6周:工资管理系统功能实现(1)第7周:工资管理系统功能实现(2)第8周:测试与调试教材章节及内容:《C语言程序设计》第3章:数据类型、运算符与表达式第4章:控制结构第6章:函数与模块化编程第7章:数组和字符串第8章:结构体与共同体第9章:文件操作教学内容紧密结合课程目标,注重科学性和系统性,通过以上教学内容,使学生能够掌握C语言编程的核心知识,并能够将其应用于工资管理系统的设计与实现。

c语言职工工资管理系统代码

c语言职工工资管理系统代码

C语言职工工资管理系统代码简介职工工资管理是一项重要的任务,它涉及到工资计算、薪资发放、绩效评估等方面。

为了提高管理的有效性和准确性,许多公司和组织都开发了各种各样的工资管理系统。

本文将介绍一种基于C语言开发的职工工资管理系统代码。

代码功能及特点1. 基本功能•添加新员工信息•更新员工信息•计算员工工资•发放工资•查询员工信息•统计工资情况2. 特点•简单易懂:代码使用C语言编写,阅读和理解都相对简单。

•高效可靠:代码采用模块化设计,结构清晰,运行效率高,容错性强。

•跨平台支持:C语言是一种具有广泛应用的语言,可以在多个操作系统上运行。

代码实现1. 员工信息结构体定义struct Employee {int id; // 员工编号char name[20]; // 员工姓名float basicSalary; // 员工基本工资float performanceBonus; // 绩效奖金float salary; // 员工工资};2. 添加新员工信息函数void addEmployee(struct Employee *employee, int num) {printf("请输入员工编号:");scanf("%d", &(employee[num].id));// 输入其他员工信息...}3. 更新员工信息函数void updateEmployee(struct Employee *employee, int id) {int i;for (i = 0; i < num; i++) {if (employee[i].id == id) {// 更新员工信息...}}}4. 计算员工工资函数void calculateSalary(struct Employee *employee, int num) {int i;for (i = 0; i < num; i++) {employee[i].salary = employee[i].basicSalary + employee[i].performance Bonus;}}5. 发放工资函数void paySalary(struct Employee *employee, int num) {int i;for (i = 0; i < num; i++) {printf("员工编号:%d,工资:%.2f\n", employee[i].id, employee[i].salar y);}}6. 查询员工信息函数void searchEmployee(struct Employee *employee, int id) {int i;for (i = 0; i < num; i++) {if (employee[i].id == id) {// 输出员工信息...}}}7. 统计工资情况函数void statisticsSalary(struct Employee *employee, int num) { float totalSalary = 0;int i;for (i = 0; i < num; i++) {totalSalary += employee[i].salary;}printf("总工资:%f\n", totalSalary);}使用示例1. 添加员工信息struct Employee employees[100];int num = 0;addEmployee(employees, num);num++;2. 更新员工信息int id = 12345;updateEmployee(employees, id);3. 计算员工工资calculateSalary(employees, num);4. 发放工资paySalary(employees, num);5. 查询员工信息int id = 12345;searchEmployee(employees, id);6. 统计工资情况statisticsSalary(employees, num);总结本文介绍了一个基于C语言的职工工资管理系统代码。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

课程设计教师工资管理系统运行平台: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_gongjijin;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。

相关文档
最新文档