|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<windows.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
|
|
|
|
|
void xitong ( );//ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void shuru(FILE *);//ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void xianshi(FILE *);//ʵ<><CAB5><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
void chazhao(FILE *);//ʵ<>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void shanchu(FILE *,char *s);//ʵ<><CAB5>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void tongji(FILE *);//ʵ<><CAB5>ͳ<EFBFBD><CDB3>
|
|
|
|
|
void xiugai(char *);//ʵ<><CAB5><EFBFBD><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
struct tongjishuju {//<2F><><EFBFBD><EFBFBD>ͳ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
double pjgz1;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
double pjgz2;//ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
double pjgz3;//<2F><><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
double pjgz4;//ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD>
|
|
|
|
|
double pjgz5;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
double pjzgz;//<2F>ܹ<EFBFBD><DCB9><EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct zhigong {//ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
char id[3];//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
char name[8];//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
int jibengongzi;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int zhiwugongzi;//ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int jintie;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
int yiliaobaoxian;//ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD>
|
|
|
|
|
int gongjijin;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int zonggongzi;//<2F>ܹ<EFBFBD><DCB9><EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void xitong( ) {//<2F><><EFBFBD>ܺ<EFBFBD><DCBA><EFBFBD>
|
|
|
|
|
int a,x;//a<><61><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>x<EFBFBD><78><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><F2BFAABE>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
system("mode con cols=100 lines=40");
|
|
|
|
|
system("color bc");
|
|
|
|
|
printf("\t\t\t\t <20>ӭʹ<D3AD><CAB9>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>\n");
|
|
|
|
|
char s[20];//<2F>洢<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
FILE *fp=NULL;
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>½<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>\n");
|
|
|
|
|
printf("1:<3A><> 2:<3A><>\n");
|
|
|
|
|
scanf("%d",&x);//ѡ<><D1A1><EFBFBD><EFBFBD><F2BFAABE>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
TTTT://ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if(x==2) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
if((fp=fopen(s,"a+"))==NULL) { //<2F>ж<EFBFBD><D0B6>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
goto TTTT; //ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(x==1) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>½<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
if((fp=fopen(s,"w+"))==NULL) { //<2F>ж<EFBFBD><D0B6>ļ<EFBFBD><C4BC>Ƿ<EFBFBD><C7B7><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD>
|
|
|
|
|
printf("<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
goto TTTT; //ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
system("cls");
|
|
|
|
|
printf(" <20><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>\n");
|
|
|
|
|
printf("1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ 2.<2E><>ʾ<EFBFBD><CABE>Ϣ\n");
|
|
|
|
|
printf("3.<2E><EFBFBD><DEB8><EFBFBD>Ϣ 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
printf("5.ɾ<><C9BE><EFBFBD><EFBFBD>Ϣ 6.ͳ<><CDB3><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رճ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&a);
|
|
|
|
|
switch(a) { //ʵ<>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
case 1://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
system("cls");
|
|
|
|
|
shuru(fp);
|
|
|
|
|
break;
|
|
|
|
|
case 2://<2F><>ʾ
|
|
|
|
|
system("cls");
|
|
|
|
|
xianshi(fp);
|
|
|
|
|
break;
|
|
|
|
|
case 3://<2F><EFBFBD>
|
|
|
|
|
system("cls");
|
|
|
|
|
xiugai(s);
|
|
|
|
|
fclose(fp);
|
|
|
|
|
break;
|
|
|
|
|
case 4://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
system("cls");
|
|
|
|
|
chazhao(fp);
|
|
|
|
|
break;
|
|
|
|
|
case 5://ɾ<><C9BE>
|
|
|
|
|
system("cls");
|
|
|
|
|
shanchu(fp,s);
|
|
|
|
|
break;
|
|
|
|
|
case 6://ͳ<><CDB3>
|
|
|
|
|
system("cls");
|
|
|
|
|
tongji(fp);
|
|
|
|
|
break;
|
|
|
|
|
default://<2F>ر<EFBFBD>
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void shuru(FILE *fp) {
|
|
|
|
|
int c;//ʵ<>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("ID<EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\tְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\tҽ<EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
struct zhigong a;
|
|
|
|
|
scanf("%s%s%d%d%d%d%d",a.id,a.name,&a.jibengongzi,&a.zhiwugongzi,&a.jintie,&a.yiliaobaoxian,&a.gongjijin);
|
|
|
|
|
a.zonggongzi=a.jibengongzi+a.gongjijin+a.jintie+a.yiliaobaoxian+a.zhiwugongzi;
|
|
|
|
|
fprintf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d\n",a.id,a.name,a.jibengongzi,a.zhiwugongzi,a.jintie,a.yiliaobaoxian,a.gongjijin,a.zonggongzi);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵽<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>2:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>رճ<D8B1><D5B3><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&c);
|
|
|
|
|
if(c==1) {
|
|
|
|
|
fclose(fp);
|
|
|
|
|
xitong( );
|
|
|
|
|
} else if(c==2) {
|
|
|
|
|
|
|
|
|
|
shuru(fp);
|
|
|
|
|
} else
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void chazhao(FILE *fp) {
|
|
|
|
|
int l;//ʵ<>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
char c[20];
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
struct zhigong a;
|
|
|
|
|
scanf("%s",c);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
while(1) {
|
|
|
|
|
if(fscanf(fp,"%s%s%d%d%d%d%d%d",a.id,a.name,&a.jibengongzi,&a.zhiwugongzi,&a.jintie,&a.yiliaobaoxian,&a.gongjijin,&a.zonggongzi)==EOF)
|
|
|
|
|
break;
|
|
|
|
|
if(strcmp(c,a.name)==0) {//<2F><><EFBFBD>ҵ<EFBFBD>
|
|
|
|
|
printf("\t%d\t%d\t%d\t%d\t%d\t%d\n",a.jibengongzi,a.zhiwugongzi,a.jintie,a.yiliaobaoxian,a.gongjijin,a.zonggongzi);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(feof(fp)!=0) {//δ<>ҵ<EFBFBD>
|
|
|
|
|
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>2:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>رճ<D8B1><D5B3><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&l);
|
|
|
|
|
if(l==1) {
|
|
|
|
|
fclose(fp);
|
|
|
|
|
xitong( );
|
|
|
|
|
} else if(l==2) {
|
|
|
|
|
rewind(fp);
|
|
|
|
|
chazhao(fp);
|
|
|
|
|
} else
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void xianshi(FILE *fp) {
|
|
|
|
|
int l,n;//lʵ<6C>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>,n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
char c[20][8];//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
struct zhigong a;
|
|
|
|
|
int i,f=0;//iʵ<69><CAB5>ѭ<EFBFBD><D1AD>,f<><66><EFBFBD>ܺ<EFBFBD>
|
|
|
|
|
printf("ID<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ְ<><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ҽ<>Ʊ<EFBFBD><C6B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ܹ<EFBFBD><DCB9><EFBFBD>\n");
|
|
|
|
|
for(i=0; i<100; i++) {//һһ<D2BB><D2BB>ʾ
|
|
|
|
|
if(fscanf(fp,"%s%s%d%d%d%d%d%d",a.id,a.name,&a.jibengongzi,&a.zhiwugongzi,&a.jintie,&a.yiliaobaoxian,&a.gongjijin,&a.zonggongzi)!=EOF)
|
|
|
|
|
printf("%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d\n",a.id,a.name,a.jibengongzi,a.zhiwugongzi,a.jintie,a.yiliaobaoxian,a.gongjijin,a.zonggongzi);
|
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
tttt://ǰ<><C7B0><EFBFBD>Ĺ<EFBFBD><C4B9>ܲ<EFBFBD><DCB2><EFBFBD>Ҫ<EFBFBD>ظ<EFBFBD>ʵ<EFBFBD><CAB5>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD>Ŀ\n");
|
|
|
|
|
scanf("%d",&n);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0; i<n; i++) {
|
|
|
|
|
rewind(fp);//ָ<><D6B8><EFBFBD>ص<EFBFBD><D8B5>ļ<EFBFBD><C4BC><EFBFBD>ʼ<EFBFBD><CABC>
|
|
|
|
|
scanf("%s",c[i]);
|
|
|
|
|
while(1) {
|
|
|
|
|
if(fscanf(fp,"%s%s%d%d%d%d%d%d",a.id,a.name,&a.jibengongzi,&a.zhiwugongzi,&a.jintie,&a.yiliaobaoxian,&a.gongjijin,&a.zonggongzi)==EOF)
|
|
|
|
|
break;
|
|
|
|
|
if(strcmp(c[i],a.name)==0) {
|
|
|
|
|
printf("\t%d\t%d\t%d\t%d\t%d\t%d\n",a.jibengongzi,a.zhiwugongzi,a.jintie,a.yiliaobaoxian,a.gongjijin,a.zonggongzi);
|
|
|
|
|
f+=a.zonggongzi;//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(feof(fp)!=0) {
|
|
|
|
|
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(n==0)
|
|
|
|
|
printf("ƽ<EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0\n");
|
|
|
|
|
else
|
|
|
|
|
printf("ƽ<EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%lf\n",(double)f/n);//<2F><>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>2:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>رճ<D8B1><D5B3><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&l);
|
|
|
|
|
if(l==1) {
|
|
|
|
|
fclose(fp);
|
|
|
|
|
xitong( );
|
|
|
|
|
} else if(l==2) {
|
|
|
|
|
rewind(fp);
|
|
|
|
|
goto tttt;
|
|
|
|
|
} else
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void tongji(FILE *fp) {
|
|
|
|
|
int c,f;//f<><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cʵ<63>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>
|
|
|
|
|
int sum=0,i,q,m1=0,m2=0,m3=0;//ʵ<><CAB5>ѭ<EFBFBD><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
struct tongjishuju a;
|
|
|
|
|
struct zhigong b[100];//<2F>ռ<EFBFBD><D5BC>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("1,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>3000Ԫ<30><D4AA><EFBFBD>ϡ<EFBFBD>3000~2000Ԫ<30><D4AA>2000~1000Ԫ<30><D4AA>ְ<EFBFBD><D6B0><EFBFBD>ٷֱ<D9B7>\n");
|
|
|
|
|
printf("2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for(i=0; i<100; i++) {
|
|
|
|
|
if(fscanf(fp,"%s%s%d%d%d%d%d%d",b[i].id,b[i].name,&b[i].jibengongzi,&b[i].zhiwugongzi,&b[i].jintie,&b[i].yiliaobaoxian,&b[i].gongjijin,&b[i].zonggongzi)==EOF)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
f=i;
|
|
|
|
|
for(i=0; i<f; i++)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
sum+=b[i].jibengongzi;
|
|
|
|
|
a.pjgz1=(double)sum/(f);
|
|
|
|
|
sum=0;
|
|
|
|
|
for(i=0; i<f; i++)//<2F><><EFBFBD><EFBFBD>ְ<EFBFBD><D6B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
sum+=b[i].zhiwugongzi;
|
|
|
|
|
a.pjgz2=(double)sum/(f);
|
|
|
|
|
sum=0;
|
|
|
|
|
for(i=0; i<f; i++)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
sum+=b[i].jintie;
|
|
|
|
|
a.pjgz3=(double)sum/(f);
|
|
|
|
|
sum=0;
|
|
|
|
|
for(i=0; i<f; i++)//<2F><><EFBFBD><EFBFBD>ҽ<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
sum+=b[i].yiliaobaoxian;
|
|
|
|
|
a.pjgz4=(double)sum/(f);
|
|
|
|
|
sum=0;
|
|
|
|
|
for(i=0; i<f; i++)//<2F><><EFBFBD>㹫<EFBFBD><E3B9AB><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
sum+=b[i].gongjijin;
|
|
|
|
|
a.pjgz5=(double)sum/(f);
|
|
|
|
|
sum=0;
|
|
|
|
|
for(i=0; i<f; i++)//<2F><><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD>ƽ<EFBFBD><C6BD>ֵ
|
|
|
|
|
sum+=b[i].zonggongzi;
|
|
|
|
|
a.pjzgz=(double)sum/(f);
|
|
|
|
|
scanf("%d",&q);
|
|
|
|
|
switch(q) {
|
|
|
|
|
case 1://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>ͳ<EFBFBD><CDB3>3000Ԫ<30><D4AA><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC>3000~2000Ԫռ<D4AA><D5BC>2000Ԫ~1000Ԫռ<D4AA><D5BC>
|
|
|
|
|
for(i=0; i<f; i++) {
|
|
|
|
|
if((b[i].jibengongzi+b[i].zhiwugongzi+b[i].jintie)>=3000)
|
|
|
|
|
m1++;
|
|
|
|
|
|
|
|
|
|
if((b[i].jibengongzi+b[i].zhiwugongzi+b[i].jintie)>=2000&&(b[i].jibengongzi+b[i].zhiwugongzi+b[i].jintie)<3000)
|
|
|
|
|
m2++;
|
|
|
|
|
|
|
|
|
|
if((b[i].jibengongzi+b[i].zhiwugongzi+b[i].jintie)<2000&&(b[i].jibengongzi+b[i].zhiwugongzi+b[i].jintie)>=1000)
|
|
|
|
|
m3++;
|
|
|
|
|
}
|
|
|
|
|
printf("3000Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ%lf\n3000~2000Ԫռ%lf\n2000Ԫ~1000Ԫռ%lf\n",(double)m1/f,(double)m2/f,(double)m3/f);
|
|
|
|
|
break;
|
|
|
|
|
case 2://ʵ<><CAB5>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
for(i=0; i<f; i++)
|
|
|
|
|
printf("%d\t%d\t%d\t%d\t%d\t%d\n",b[i].jibengongzi,b[i].zhiwugongzi,b[i].jintie,b[i].yiliaobaoxian,b[i].gongjijin,b[i].zonggongzi);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ:");
|
|
|
|
|
printf("%lf\t%lf\t%lf\t%lf\t%lf\t%lf\n",a.pjgz1,a.pjgz2,a.pjgz3,a.pjgz4,a.pjgz5,a.pjzgz);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>2:<3A><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>رճ<D8B1><D5B3><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&c);
|
|
|
|
|
if(c==1) {//ʵ<>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>ȹ<EFBFBD><C8B9><EFBFBD>
|
|
|
|
|
fclose(fp);
|
|
|
|
|
xitong( );
|
|
|
|
|
} else if(c==2) {
|
|
|
|
|
rewind(fp);
|
|
|
|
|
tongji(fp);
|
|
|
|
|
} else
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void shanchu(FILE *fp,char *s) {
|
|
|
|
|
int d,l,i,m,z=0;//d<><64><EFBFBD><EFBFBD>ѭ<EFBFBD><D1AD>ʱ<EFBFBD>䣬lʵ<6C>ֹ<EFBFBD><D6B9>ܷ<EFBFBD><DCB7><EFBFBD>ʵ<EFBFBD>֣<EFBFBD>iʵ<69><CAB5>ѭ<EFBFBD><D1AD>,mʵ<6D>ּ<EFBFBD>סɾ<D7A1><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,z<>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
struct zhigong a[100];
|
|
|
|
|
char c[20];
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",c);
|
|
|
|
|
for(i=0; i<100; i++) {
|
|
|
|
|
if(fscanf(fp,"%s%s%d%d%d%d%d%d",a[i].id,a[i].name,&a[i].jibengongzi,&a[i].zhiwugongzi,&a[i].jintie,&a[i].yiliaobaoxian,&a[i].gongjijin,&a[i].zonggongzi)==EOF) {
|
|
|
|
|
d=i;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(strcmp(c,a[i].name)==0) {
|
|
|
|
|
m=i;
|
|
|
|
|
z=1;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(z==0)
|
|
|
|
|
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
if(z==1) {//<2F><><EFBFBD>´<EFBFBD><C2B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ȼ<EFBFBD><EFBFBD><F3BDABB3><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>룬Ȼ<EBA3AC><C8BB><EFBFBD><EFBFBD>ԭ<EFBFBD>ļ<EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
fclose(fp);
|
|
|
|
|
remove(s);//ɾ<><C9BE>
|
|
|
|
|
fp=NULL;
|
|
|
|
|
fp=fopen("a.txt","a+");
|
|
|
|
|
for(i=0; i<d; i++) {
|
|
|
|
|
if(i!=m)
|
|
|
|
|
fprintf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d\t",a[i].id,a[i].name,a[i].jibengongzi,a[i].zhiwugongzi,a[i].jintie,a[i].yiliaobaoxian,a[i].gongjijin,a[i].zonggongzi);
|
|
|
|
|
}
|
|
|
|
|
rename("a.txt",s);//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>2:<3A><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>رճ<D8B1><D5B3><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&l);
|
|
|
|
|
if(l==1) {
|
|
|
|
|
fclose(fp);
|
|
|
|
|
xitong( );
|
|
|
|
|
} else if(l==2) {
|
|
|
|
|
rewind(fp);
|
|
|
|
|
shanchu(fp,s);
|
|
|
|
|
} else
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void xiugai(char *s) {
|
|
|
|
|
int l,i,z=0;
|
|
|
|
|
long int f=0;
|
|
|
|
|
struct zhigong a[100];
|
|
|
|
|
FILE *fp;
|
|
|
|
|
fp=fopen(s,"r+");
|
|
|
|
|
char c[20];
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",c);
|
|
|
|
|
for(i=0; i<100; i++) {
|
|
|
|
|
if(i==0)
|
|
|
|
|
f=0;
|
|
|
|
|
else
|
|
|
|
|
f=(ftell(fp)+2);
|
|
|
|
|
if(fscanf(fp,"%s%s%d%d%d%d%d%d",a[i].id,a[i].name,&a[i].jibengongzi,&a[i].zhiwugongzi,&a[i].jintie,&a[i].yiliaobaoxian,&a[i].gongjijin,&a[i].zonggongzi)==EOF) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if(strcmp(c,a[i].name)==0) {
|
|
|
|
|
z=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(feof(fp)!=0)
|
|
|
|
|
printf("û<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
if(z==1) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>Ϣ\n");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",a[i].id);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%s",a[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&a[i].jibengongzi);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&a[i].zhiwugongzi);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD>Ʊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&a[i].yiliaobaoxian);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&a[i].yiliaobaoxian);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&a[i].gongjijin);
|
|
|
|
|
a[i].zonggongzi=a[i].jibengongzi+a[i].gongjijin+a[i].jintie+a[i].yiliaobaoxian+a[i].zhiwugongzi;
|
|
|
|
|
rewind(fp);
|
|
|
|
|
fseek(fp,f,SEEK_SET);
|
|
|
|
|
fprintf(fp,"%s\t%s\t%d\t%d\t%d\t%d\t%d\t%d",a[i].id,a[i].name,a[i].jibengongzi,a[i].zhiwugongzi,a[i].jintie,a[i].yiliaobaoxian,a[i].gongjijin,a[i].zonggongzi);
|
|
|
|
|
}
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>2:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A>رճ<D8B1><D5B3><EFBFBD>\n");
|
|
|
|
|
scanf("%d",&l);
|
|
|
|
|
if(l==1) {
|
|
|
|
|
fclose(fp);
|
|
|
|
|
xitong( );
|
|
|
|
|
} else if(l==2) {
|
|
|
|
|
rewind(fp);
|
|
|
|
|
xiugai(s);
|
|
|
|
|
} else
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|