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.
73 lines
1.5 KiB
73 lines
1.5 KiB
1 year ago
|
#include <stdio.h>
|
||
|
int main(){
|
||
|
char a;
|
||
|
float s1[4];
|
||
|
float s2[4];
|
||
|
float s3[4];
|
||
|
float an[3],b[3];
|
||
|
int c[3];
|
||
|
|
||
|
|
||
|
printf(" 1.Input\n");
|
||
|
printf(" 2.Output\n");
|
||
|
printf(" 3.Order\n");
|
||
|
printf(" 4.Quit\n");
|
||
|
scanf("%c",&a);
|
||
|
if(a=='i')
|
||
|
{
|
||
|
printf("You are trying to Input info\n");
|
||
|
scanf("%d %f %f %f",&s1[0],&s1[1],&s1[2],&s1[3]);
|
||
|
scanf("%d %f %f %f",&s2[0],&s2[1],&s2[2],&s2[3]);
|
||
|
scanf("%d %f %f %f",&s3[0],&s3[1],&s3[2],&s3[3]);
|
||
|
an[0]=s1[1]+s1[2]+s1[3];
|
||
|
an[1]=s2[1]+s2[2]+s2[3];
|
||
|
an[2]=s3[1]+s3[2]+s3[3];
|
||
|
b[0]=(s1[1]+s1[2]+s1[3])/3;
|
||
|
b[1]=(s2[1]+s2[2]+s2[3])/3;
|
||
|
b[2]=(s3[1]+s3[2]+s3[3])/3;
|
||
|
c[0]=s1[0];
|
||
|
c[1]=s2[0];
|
||
|
c[2]=s3[0];
|
||
|
int i,j;
|
||
|
float t;
|
||
|
for(i=0;i<3;i++)
|
||
|
{
|
||
|
for(j=i+1;j<3;j++)
|
||
|
{
|
||
|
if(an[i]>an[j])
|
||
|
{
|
||
|
t=an[j];
|
||
|
an[j]=an[i];
|
||
|
an[i]=t;
|
||
|
t=b[j];
|
||
|
b[j]=b[i];
|
||
|
b[i]=t;
|
||
|
t=c[j];
|
||
|
c[j]=c[i];
|
||
|
c[i]=t;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
for(i=0;i<3;i++)
|
||
|
printf("%d %.1f %.1f",c[i],an[i],b[i]);
|
||
|
}
|
||
|
else if(a=='o')
|
||
|
{
|
||
|
printf("You are trying to Output info");
|
||
|
}
|
||
|
else if(a=='m')
|
||
|
{
|
||
|
printf("You are trying to Make things ordered");
|
||
|
}
|
||
|
else if(a=='q')
|
||
|
{
|
||
|
printf("You are about to quit");
|
||
|
}
|
||
|
else{
|
||
|
printf("Wrong input");
|
||
|
}
|
||
|
|
||
|
|
||
|
return 0;
|
||
|
}
|