You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.7 KiB

6 years ago
#include<stdio.h> //<2F><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include<stdlib.h> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEBAAF><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><E4BAAF>
#include<string.h> //<2F>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#include <time.h> //<2F>õ<EFBFBD><C3B5><EFBFBD>time<6D><65><EFBFBD><EFBFBD>
int main()
{
int num=0;
while(1)
{
system("cls");
load();
printf("|----<2D><EFBFBD><E8B3AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ----\n");
printf("\n ----------------------\n");
printf("| [1] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ¼<CFA2><C2BC> |\n");
printf("| [2] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ʾ |\n");
printf("| [3] <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ |\n");
printf("| [4] <20>޸<EFBFBD><DEB8><EFBFBD>ί<EFBFBD><CEAF><EFBFBD><EFBFBD> |\n");
printf("| [5] <20><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |\n");
printf("| [6] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |\n");
printf("| [7] <20>˳<EFBFBD>ϵͳ |\n");
printf(" ----------------------\n");
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>еIJ<EFBFBD><EFBFBD><EFBFBD>:");
scanf("%d",&num);
switch(num)//<2F>˵<EFBFBD>
{
case 1 : info_sign();break;//¼<><C2BC>
case 2 : info_show();break;//<2F><>ʾ
case 3 : info_find();break;//<2F><><EFBFBD><EFBFBD>
case 4 : grade_modify();break;//<2F>޸<EFBFBD>
case 5 : find_order();break;
case 6 : result_sort();break;
case 7 : exit(0);
}
}
}
struct node{
int id;//<2F><><EFBFBD><EFBFBD>
char name[20];//<2F><><EFBFBD><EFBFBD>
double score[11];//<2F>ɼ<EFBFBD>
double sum;//ƽ<><C6BD><EFBFBD><EFBFBD>
}st[100],s;
int snum=0;
int load() /********************************************<2A><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5>ڴ<EFBFBD> *************************************/
{
snum=0;
FILE *fp; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ָ<EFBFBD><D6B8>
fp=fopen("info.txt","r"); //<2F>Զ<EFBFBD><D4B6>ķ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
if(fp==NULL)
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>info.dat<61>ļ<EFBFBD><C4BC><EFBFBD>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
}
else{
while(!feof(fp)){//<2F><><EFBFBD><EFBFBD> <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
fread(&st[snum++],sizeof(struct node),1,fp); //snum<75>Dz<EFBFBD><C7B2><EFBFBD>ѡ<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ȡһ<C8A1><D2BB><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>һ<EFBFBD>Ρ<EFBFBD>
}
}
if(snum>0)
snum--;
else snum=0;
fclose(fp);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d\n",snum);
return 0;
}
int save() /**********************************<2A><><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>ļ<EFBFBD>******************************************/
{
FILE *fp;
int i,t=0;
fp=fopen("info.txt","w");//<2F><>д<EFBFBD>ķ<EFBFBD>ʽ<EFBFBD>򿪲<EFBFBD><F2BFAAB2><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ϣ<EFBFBD>ļ<EFBFBD>
for(i=0;i<snum;i++){
fwrite(&st[i],sizeof(struct node),1,fp);
//<2F><><EFBFBD>ν<EFBFBD><CEBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD>st<73><EFBFBD><E1B9B9>
}
fclose(fp);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\n");
//printf("%d\n",snum);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>Ϳγ<CDBF><CEB3><EFBFBD>Ŀ
return 0;
}
int info_sign() /*************************<2A><><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>Ϣ *********************/
{
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d\n",snum);
int i;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%d",&st[snum].id);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
scanf("%s",st[snum].name);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʮλ<EFBFBD><EFBFBD>ί<EFBFBD>ɼ<EFBFBD>:\n");
st[snum].sum=0;
double mi=0xffffff,ma=0;
for( i=0;i<10;i++)
{
scanf("%lf",&st[snum].score[i]);
if(mi>st[snum].score[i])
{
mi=st[snum].score[i];
}
if(ma<st[snum].score[i])
{
ma=st[snum].score[i];
}
st[snum].sum+=st[snum].score[i];
}
st[snum].sum=st[snum].sum-mi-ma;
st[snum].sum/=8;//<2F><>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD>
snum++;
save();//<2F><><EFBFBD>ڽṹ<DABD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>±<EFBFBD><C2B1><EFBFBD><E6BAAF>
getchar();getchar();
}