From 69926135f05c9392a010b6402a333c148326cec7 Mon Sep 17 00:00:00 2001 From: powf2zncv <3313430869@qq.com> Date: Thu, 16 Nov 2023 18:36:38 +0800 Subject: [PATCH] Update README.md --- README.md | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) diff --git a/README.md b/README.md index 51d6a71..c0b0816 100644 --- a/README.md +++ b/README.md @@ -396,7 +396,155 @@ struct Scoreb student1={10001,11,"Zhang",99.5,88.5,89.5,277.5}; } 步骤七 +#include +#include +struct student + { + int number; + int clas; + char name[10]; + float grade1; + float grade2; + float grade3; + float sum; + int signal; + }student[7]={{10001,11,"Zhang",99.5,88.5,89.5,0,0}, + {10002,12,"Yang",77.9,56.5,87.5,0,0}, + {10003,11,"Liang",92.5,99.0,60.5,0,0}, + {10004,11,"Cai",89.6,56.9,90.5,0,0}, + {10005,14,"Fu",55.6,67.9,98.9,0,0}, + {10006,12,"Mao",22.1,45.9,99.2,0,0}, + {10007,13,"Zhan",35.6,67.9,88.0,0,0} + }; +struct student temp; + + +void clas(); +void number(); +void name(); +void grade(); +void classandnumber(); + +const int n=7; +int main() +{ + int identity; + scanf("%d",&identity); + for(int i=0;i<7;i++) + { + student[i].sum=student[i].grade1+student[i].grade2+student[i].grade3; + } + int i,j,k; + for(i=0;istudent[k].sum) + { + k=j; + } + } + } + temp=student[k]; + student[k]=student[i]; + student[i]=temp; + } + switch(identity) + { + case 1:clas();break; + case 2:number();break; + case 3:name();break; + case 4:grade();break; + case 5:classandnumber();break; + default:printf("Wrong input!\n"); + } + for(i=0;i=inf&&student[i].clas<=sup) + student[i].signal=1; + } +} + +void number() +{ + int inf,noun,sup; + scanf("%d%c%d",&inf,&noun,&sup); + for(int i=0;i<7;i++) + { + if(student[i].number>=inf&&student[i].number<=sup) + student[i].signal=1; + } +} + +void name() +{ + int i=0,k,count; + char initial[10]; + scanf("%s",initial); + printf("%s\n",initial); + count=strlen(initial); + bool flag=true; + for(int i=0;i=inf) + student[i].signal=1; + } +} + +void classandnumber() +{ + int clas,noun1,inf,noun2,sup; + scanf("%d%c%d%c%d",&clas,&noun1,&inf,&noun2,&sup); + for(int i=0;i<7;i++) + { + if(student[i].clas==clas) + { + if(student[i].number>=inf&&student[i].number<=sup) + student[i].signal=1; + } + } +} 步骤八 #include #include