教师工作量管理系统

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

#include

#include

#include

# define XZH 20

# define XZM 20

# define XG 100

typedef struct TeaSalary{

char number[15];

char name[10];

float DHF;

float JBGZ;

float JT;

float SHBT;

float YFGZ;

float SDF;

float FZ;

float SDS;

float WSF;

float GJJ;

float SFGZ;

float HJKF;

}TeaSalary;

long size=sizeof(struct TeaSalary);

long getcount(FILE *fp);

void newteacher(FILE *fp);

void showteacher(FILE *fp);

void searchteacher(FILE *fp);

void changeteacher(FILE *fp);

void keepteacher(FILE *fp);

void orderteacher(FILE *fp);

void searchname(FILE *fp,char *name);

void searchnumber(FILE *fp,char *number);

void deleteteacher(FILE *fp);

void deletenumber(FILE *fp);

void deletename(FILE *fp);

void changenumber(FILE *fp);

void changename(FILE *fp);

int main() /*主函数*/

{

FILE *fp;

int choice;

long count;

if((fp=fopen("e:\\teacher.txt" ,"a+"))==NULL){

printf("Can not open file teacher.txt!\n");

exit(0);

}

count=getcount(fp);

printf("\t\t 欢迎来到教师工资管理系统\t\t\n"); printf("\t\t该程序由“龙圣”、“郭亚”制作\t\t\n"); printf("\t\t 计本-092班\t\t\n"); do

{

printf("文件中记录数为:%d\n",count);

printf("\t\t1-输入功能,\t2-显示功能\n");

printf("\t\t3-查找功能,\t4-修改功能\n");

printf("\t\t5-删除功能,\t6-保存功能\n");

printf("\t\t7-排序功能,\t0-退出功能\n");

printf("请进行选择:\n");

scanf("%d",&choice);

switch(choice){

case 1:

newteacher( fp); count++;

break;

case 2:

showteacher( fp);

break;

case 3:

searchteacher( fp);

break;

case 4:

changeteacher( fp);

break;

case 5:

deleteteacher( fp); count--;

break;

case 6:

keepteacher( fp);

break;

case 7:

orderteacher( fp);

break;

case 0:

break;

default:

printf("您选择错误,请重新选择\n");

break;

}

}while(choice!=0);

if(fclose(fp)){

printf("Can not close the file teacher.txt!\n");

exit(0);

}

fclose(fp);

printf("感谢使用!\n");

return 0;

}

long getcount(FILE *fp) /*读取文件记录数*/

{

long begin,end,logcount;

fseek(fp,0L,0);

begin=ftell(fp);

fseek(fp,size,2);

end=ftell(fp);

logcount=(end-begin)/size-1;

return logcount;

}

/*输入新记录*/

void newteacher(FILE *fp) /*将新记录添加到文件中*/

{

TeaSalary f;

printf("输入教师号:");

scanf("%s",f.number);

printf("姓名:");

scanf("%s",);

printf("基本工资:");

scanf("%f",&f.JBGZ);

printf("津贴:");

scanf("%f",&f.JT);

printf("生活补贴:");

scanf("%f",&f.SHBT);

printf("电话费:");

scanf("%f",&f.DHF);

printf("水电费:");

scanf("%f",&f.SDF);

printf("房租:");

scanf("%f",&f.FZ);

printf("所得税:");

scanf("%f",&f.SDS);

相关文档
最新文档