parent
1c1707fadb
commit
5c0de1a52d
@ -1,95 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
void input();
|
|
||||||
void order();
|
|
||||||
void output();
|
|
||||||
void menu();
|
|
||||||
int sum=0;
|
|
||||||
struct stu
|
|
||||||
{
|
|
||||||
int Id;
|
|
||||||
float score1;
|
|
||||||
float score2;
|
|
||||||
float score3;
|
|
||||||
float score;
|
|
||||||
float arvscore;
|
|
||||||
}stu[1000];
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
menu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void menu()
|
|
||||||
{
|
|
||||||
char t;
|
|
||||||
printf(" 1.Input\n");
|
|
||||||
printf(" 2.output\n");
|
|
||||||
printf(" 3.order\n");
|
|
||||||
printf(" 4.quit\n");
|
|
||||||
t=getchar();
|
|
||||||
if(t=='i')
|
|
||||||
{
|
|
||||||
printf("You are trying to Input info\n");
|
|
||||||
for(int i=0;i<3;i++)
|
|
||||||
{
|
|
||||||
input();
|
|
||||||
}
|
|
||||||
order();
|
|
||||||
output();
|
|
||||||
}
|
|
||||||
else if(t=='o')
|
|
||||||
{
|
|
||||||
printf("You are trying to Output info\n");
|
|
||||||
}
|
|
||||||
else if(t=='m')
|
|
||||||
{
|
|
||||||
printf("You are trying to Make things ordered\n");
|
|
||||||
}
|
|
||||||
else if(t=='q')
|
|
||||||
{
|
|
||||||
printf("You are about to Quit\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(t!='\n')
|
|
||||||
{
|
|
||||||
printf("Wrong input\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void input()
|
|
||||||
{
|
|
||||||
sum=sum+1;
|
|
||||||
scanf("%d",&stu[sum].Id);
|
|
||||||
scanf("%f",&stu[sum].score1);
|
|
||||||
scanf("%f",&stu[sum].score2);
|
|
||||||
scanf("%f",&stu[sum].score3);
|
|
||||||
stu[sum].score=stu[sum].score3+stu[sum].score2+stu[sum].score1;
|
|
||||||
stu[sum].arvscore=stu[sum].score/3;
|
|
||||||
}
|
|
||||||
void order()
|
|
||||||
{
|
|
||||||
for(int i=1;i<=sum;i++)
|
|
||||||
{
|
|
||||||
for(int j=i;j<=sum;j++)
|
|
||||||
{
|
|
||||||
if(stu[i].score>stu[j].score)
|
|
||||||
{
|
|
||||||
stu[sum+1]=stu[i];
|
|
||||||
stu[i]=stu[j];
|
|
||||||
stu[j]=stu[sum+1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void output()
|
|
||||||
{
|
|
||||||
for(int i=1;i<=sum;i++)
|
|
||||||
{
|
|
||||||
printf("%d %.1f %.1f\n",stu[i].Id,stu[i].score,stu[i].arvscore);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue