include
include
#include
#define LEN sizeoffstruct teacher) struct teacher *creat();
struct teacher
int num;
char name[10];
char sex[8];
char unit[10];
char address[10];
long telnum;
float salary_l;
float allowance;
float life allow;
float salary_2;
float tel_fee;
float tax;
float health_fee;
float water_fee;
float rent;
float grant;
float total_fee;
float actual_salary;
struct teacher *next;
};
int n;
struct teacher *head;
FILE *fp;
struct teacher *creat(void)
{
struct teacher *pl,*p2;
n=0; pl=p2=(struct teacher *)malloc(LEN); printfC教师号门;
scanf("%d",&pl->num);fflush(stdin); printff'教师姓名:”); gets(pl-〉n ame);
printf (n教师性别:“); gets(pl->sex);
printf ("单位名称:”);
gets(pl-> unit);
print f(”家庭地址:“);
gets(pl->address);
p rintfC吨话号码:”); scanf("%ld"/&pl->telnum);fflush(stdin);
printf (n基本工资:“);
scanf("%f",&pl->salary_l);fflush(stdin);
printff1 津贴:”);
scan &pl->allowance);fflush(stdin);
print f(”生活补贴:“);
scanf(H%f",&pl->life_allow);fflush(stdin);
printff'电话费:”);
scanf("%f",&pl->tel_fee);fflush(stdin);
pri ntf(“个人所得税:”);
scanf("%f"z&pl->tax);fflush(stdin);
p rintf(n房租:“);
scanf("%f",&pl->rent);fflush(stdin);
p rintf(”公积金:“);
scanf("%f"z&pl->grant);fflush(stdin);
printff'水电费
scanff"% 化&pl->water_fee);fflush(stdin);
pri ntf(”卫生费:”); scanf("%f",&pl->health_fee);fflush(stdin);
pl->salary_2=pl->salary_l+pl->allowa nce+pl->life_allow; pl->total_fee=pl->tel_fee+pl->water_fee+pl->re nt+pl->tax+pl->health_fee+pl->gra nt;
pl->actual_salary=pl->salary_2-pl->total_fee;
head=NULL;
while(pl->num!=O)
{
n 二 n+1;
讦(n 二=l)head=pl;
else p2->next=pl;
p2=pl;
pl=(struct teacher*)malloc(LEN);
prin tf(“教师号:“);
scanf("%d",&pl->num);fflush(stdin);
prin tf(”教师姓名门;
getsfpl->n ame);
pri ntf(“教师性别:“);
gets(pl->sex);
pri ntf(惮位名称:“);
getsfpl->unit);
pr intf(”家庭地址:”);
gets(pl->address);
printf(H电话号码:“);
scanf(“%ld”,&pl?>telnum);fflush(stdin);
pri ntf(”基本工资
scanf("%f",&pl->salary_l);fflush(stdin);
printfC 津贴:“);
scan &pl->allowance);fflush(stdin);
pr intf(”生活补贴:”);
scanf("%f"z&pl