c语言程序设计教师工资管理系统Word格式.docx
《c语言程序设计教师工资管理系统Word格式.docx》由会员分享,可在线阅读,更多相关《c语言程序设计教师工资管理系统Word格式.docx(10页珍藏版)》请在冰豆网上搜索。
输入教师号,读出并显示该教师信息,输入新数据,将改后信息写入文件
(4)教师数据查询:
输入教师号或其他信息,即读出所有数据信息,并显示出来。
(5)教师综合信息输出
输出教师信息到屏幕。
1.课程设计目的和要求
A.巩固和加强《c语言程序设计》课程的理论知识。
B.掌握c语言的基本概念,语法,语义和数据类型的使用特点。
C.掌握c语言程序设计的方法及编程技巧,能正确使用c语言编写程序。
D.进一步理解和运用结构化程序设计的思想和放法。
E.使学生掌握调试程序的基本方法及上机操作方法。
F.通过查询手册和文献资料,培养学生独立分析问题和解决问题的能力。
G.初步掌握开发一个小型实用系统的基本方法。
H.培养学生的创新能力和创新思维。
I.培养学生良好的程序设计风格。
进一步理解和运用
2.课程设计题目及容
教师名,,性别,单位名称,家庭住址,联系,基本工资,津贴,生活补贴,应发工资,费,水电费,房租,所得税,卫生费,公积金,合计扣款,实发工资。
实发工资=应发工资—合计扣款。
1教师信息处理J.输入教师信息
K.插入(修改)教师信息L.删除教师信息;
M.浏览教师信息;
(提示:
)2教师数据处理;
A.按教师号录入教师基本工资,津贴,生活补贴,费,水电费,房租,所得税,
卫生费,公积金等基本信息;
B.教师实发工资、应发公资、合计扣款;
C.教师数据管理;
输入教师号,读出并显示该教师信息,输入新数据,将改后信息写入文件。
)D.教师数据查询;
输入教师好或其他信息,即读出所有数据信息,并显示出来。
)E.教师综合信息输出;
(提示;
一、需求分析①教师信息处理
A输入教师信息
B插入修改教师信息C删除教师信息D浏览教师信息
②教师数据处理
A按教师号录入教师基本工资、津贴、生活补贴、费、水电费、房租、所得税、卫生费、公积金等基本数据。
B教师实发工资,应发工资,合计扣款计算。
C教师数据管理D教师数据查询E教师综合信息输出
二总体设计4.总体设计
建立动态链表。
删除结点
插入结点
源程序
#include<
stdio.h>
#include<
stdlib.h>
conio.h>
#defineLENsizeof(structteacher)structteacher*creat();
structteacher{intnum;
charname[10];
charsex[8];
charunit[10];
charaddress[10];
longtelnum;
floatsalary_1;
floatallowance;
floatlife_allow;
floatsalary_2;
floattel_fee;
floattax;
floathealth_fee;
floatwater_fee;
floatrent;
floatgrant;
floattotal_fee;
floatactual_salary;
structteacher*next;
};
intn;
structteacher*head;
FILE*fp;
structteacher*creat(void){structteacher*p1,*p2;
n=0;
p1=p2=(structteacher*)malloc(LEN);
printf("
教师号:
"
);
scanf("
%d"
&
p1->
num);
fflush(stdin);
教师:
gets(p1->
name);
教师性别:
sex);
printf("
单位名称:
unit);
家庭地址:
address);
:
%ld"
telnum);
基本工资:
%f"
salary_1);
津贴:
allowance);
生活补贴:
life_allow);
费:
tel_fee);
个人所得税:
tax);
房租:
rent);
公积金:
grant);
水电费:
water_fee);
卫生费:
health_fee);
salary_2=p1->
salary_1+p1->
allowance+p1->
life_allow;
total_fee=p1->
tel_fee+p1->
water_fee+p1->
rent+p1->
tax+p1->
health_fee+p1->
grant;
p1->
actual_salary=p1->
salary_2-p1->
total_fee;
head=NULL;
while(p1->
num!
=0){n=n+1;
if(n==1)head=p1;
elsep2->
next=p1;
p2=p1;
p1=(structteacher*)malloc(LEN);
}p2->
next=NULL;
return(head);
}
voidprint(structteacher*head){structteacher*p;
\nNow,These%drecordsare:
\n"
n);
p=head;
if(head!
=NULL)do{printf("
%5d\t\t"
p->
%-10s\n"
%-6s\t\t"
%-10s\t"
%8ld\n"
%5.0f\t\t"
%5.0f\n"
%5.0f\t"
\t费:
应发工资:
salary_2);
合计扣款:
total_fee);
实发工资:
%5.0f\n\n\n"
actual_salary);
p=p->
next;
}while(p!
=NULL);
structteacher*insert(structteacher*head,structteacher*teach){structteacher*p0,*p1,*p2;
p1=head;
p0=teach;
if(head==NULL){head=p0;
p0->
}else{while((p0->
num>
num)&
&
(p1->
next!
=NULL)){p2=p1;
p1=p1->
}if(p0->
num<
num){if(head==p1)head=p0;
next=p0;
p0->
}else{p1->
}}n=n+1;
}
structteacher*del(structteacher*head,intnumber){structteacher*p1,*p2;
if(head==NULL){printf("
\nlistnull\n"
return(head);
}p1=head;
while(number!
=p1->
num&
=NULL){p2=p1;
}if(number==p1->
num){if(p1==head)head=p1->
next=p1->
删除:
%d\n"
number);
n=n-1;
}elseprintf("
%ldisnotfound\n"
voidsave(){inti;
structteacher*p1;
if((fp=fopen("
teacher_list"
"
wb"
))==NULL){printf("
cannotopenfile\n"
return;
for(i=0;
i<
n;
i++)
{if(fwrite(p1,sizeof(structteacher),1,fp)!
=1)printf("
filewriteerror\n"
p1=p1->
fclose(fp);
voidload(){
structteacher*p1,*p2;
rb"
p1=p2=(structteacher*)malloc(LEN);
head=p1;
do{
if(fread(p1,sizeof(structteacher),1,fp)!
=1){printf("
fileerror\n"
gotoend;
if(p1->
p1=(structteacher*)malloc(LEN);
p2->
}elsebreak;
}while
(1);
end:
fclose(fp);
voidquery(structteacher*p){intno;
pleaseinputnum:
scanf("
no);
while(p->
=no)p=p->
voidedit(structteacher*p){inta;
a);
%d\n\n"
a);
for(;
;
){if(p->
num==a){printf("
请输入新数据:
p->
gets(p->
工作单位:
salary_2=p->
salary_1+p->
allowance+p->
total_fee=p->
tel_fee+p->
water_fee+p->
rent+p->
tax+p->
health_fee+p->
p->
actual_salary=p->
salary_2-p->
break;
p=p->
}}
voidwelcome(){
\t\t\t+---------------------------+\n"
\t\t\t||\n"
\t\t\t|欢迎使用教师工资管理系统|\n"
\n\n"
charmainmenu()
{charchoice;
\n温馨提示:
为保证您的操作得到保存,请按正常顺序退出系统^_^\n"
\t\t\t--------------------------------\n"
\t\t\t|教师工资管理系统|\n"
\t\t\t|[1]----输入教师信息|\n"
\t\t\t|[2]----插入教师信息|\n"
\t\t\t|[3]----删除教师信息|\n"
\t\t\t|[4]----浏览教师信息|\n"
\t\t\t|[5]----录入教师信息|\n"
\t\t\t|[6]----查询教师信息|\n"
\t\t\t|[7]----修改教师信息|\n"
\t\t\t|[8]----加载教师信息|\n"
\t\t\t|[0]----退出系统|\n"
\t\t\t|*·
*·
|\n"
请输入您的选择:
do{fflush(stdin);
%c"
choice);
}while(choice<
'
0'
||choice>
8'
return(choice);
voidmain()
{structteacher*teach;
intdel_num;
charchoice;
while
(1){welcome();
choice=mainmenu();
switch(choice){case'
system("
cls"
exit(0);
case'
1'
inputrecords:
head