commit 3a1c34f236c6912e2a36853791c79e581ae284b0 Author: 刘泓麟 <616907652@qq.com> Date: Fri Jan 11 16:06:18 2019 +0800 first commit diff --git a/Makefile.win b/Makefile.win new file mode 100644 index 0000000..7babedb --- /dev/null +++ b/Makefile.win @@ -0,0 +1,28 @@ +# Project: γƣְʹϵͳ +# Makefile created by Dev-C++ 5.11 + +CPP = g++.exe -D__DEBUG__ +CC = gcc.exe -D__DEBUG__ +WINDRES = windres.exe +OBJ = main.o +LINKOBJ = main.o +LIBS = -L"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/lib" -L"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib" -static-libgcc -g3 +INCS = -I"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/include" -I"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" +CXXINCS = -I"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/include" -I"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"E:/C/Dev-Cpp/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" +BIN = γƣְʹϵͳ.exe +CXXFLAGS = $(CXXINCS) -g3 +CFLAGS = $(INCS) -g3 +RM = rm.exe -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before $(BIN) all-after + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +$(BIN): $(OBJ) + $(CC) $(LINKOBJ) -o $(BIN) $(LIBS) + +main.o: main.c + $(CC) -c main.c -o main.o $(CFLAGS) diff --git a/lxhml.h b/lxhml.h new file mode 100644 index 0000000..2e2316f --- /dev/null +++ b/lxhml.h @@ -0,0 +1,368 @@ +#include +#include +#include +#include + +void xitong ( );//ϵͳ +void shuru(FILE *);//ʵ +void xianshi(FILE *);//ʵʾ +void chazhao(FILE *);//ʵֲ +void shanchu(FILE *,char *s);//ʵɾ +void tongji(FILE *);//ʵͳ +void xiugai(char *);//ʵ޸ + +struct tongjishuju {//ͳƵ + double pjgz1;//ƽֵ + double pjgz2;//ְƽֵ + double pjgz3;//ƽֵ + double pjgz4;//ҽƱ + double pjgz5;// + double pjzgz;//ܹ +}; + +struct zhigong {//ְ + char id[3];// + char name[8];// + int jibengongzi;// + int zhiwugongzi;//ְ + int jintie;// + int yiliaobaoxian;//ҽƱ + int gongjijin;// + int zonggongzi;//ܹ +}; + +void xitong( ) {//ܺ + int a,x;//aѡxѡ򿪾ļ½ļ + system("mode con cols=100 lines=40"); + system("color bc"); + printf("\t\t\t\t ӭʹְϵͳ\n"); + char s[20];//洢ļ + FILE *fp=NULL; + printf("ǷҪ½һļ\n"); + printf("1: 2:\n"); + scanf("%d",&x);//ѡ򿪾ļ½ļ +TTTT://ʵ + if(x==2) { + printf("Ҫ򿪵ļ\n"); + scanf("%s",s); + if((fp=fopen(s,"a+"))==NULL) { //жļǷȷ + printf("ļ򿪴\n"); + goto TTTT; //ʵ + } + } + if(x==1) { + printf("Ҫ½ļ\n"); + scanf("%s",s); + if((fp=fopen(s,"w+"))==NULL) { //жļǷȷ + printf("ļ򿪴\n"); + goto TTTT; //ʵ + } + } + system("cls"); + printf(" ѡҪĹ\n"); + printf("1.Ϣ 2.ʾϢ\n"); + printf("3.޸Ϣ 4.Ϣ\n"); + printf("5.ɾϢ 6.ͳϢ\n"); + printf("رճ\n"); + scanf("%d",&a); + switch(a) { //ʵָ + case 1:// + system("cls"); + shuru(fp); + break; + case 2://ʾ + system("cls"); + xianshi(fp); + break; + case 3://޸ + system("cls"); + xiugai(s); + fclose(fp); + break; + case 4:// + system("cls"); + chazhao(fp); + break; + case 5://ɾ + system("cls"); + shanchu(fp,s); + break; + case 6://ͳ + system("cls"); + tongji(fp); + break; + default://ر + exit(1); + } +} + +void shuru(FILE *fp) { + int c;//ʵּͷ˵ + printf("Ҫӵ\n"); + printf("ID\t\t\tְ\t\tҽƱ\t\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);//뵽ļ + printf("1: 2: :رճ\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;//ʵּͷ˵ + char c[20]; + printf("Ҫҵݵ\n"); + struct zhigong a; + scanf("%s",c);//ҵ + 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) {//ҵ + 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) {//δҵ + printf("ûҵй\n"); + } + printf("1: 2: :رճ\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ʵּͷ˵,n + char c[20][8];// + struct zhigong a; + int i,f=0;//iʵѭ,fܺ + printf("ID ְ ҽƱ ܹ\n"); + for(i=0; i<100; i++) {//һһʾ + 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://ǰĹܲҪظʵ + printf("ҪҵݵĿ\n"); + scanf("%d",&n); + printf("Ҫҵݵ\n"); + for(i=0; i=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Ԫռ%lf\n3000~2000Ԫռ%lf\n2000Ԫ~1000Ԫռ%lf\n",(double)m1/f,(double)m2/f,(double)m3/f); + break; + case 2://ʵƽ + for(i=0; i