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.
93 lines
2.3 KiB
93 lines
2.3 KiB
1 year ago
|
|
||
|
#include <stdio.h>
|
||
|
int main()
|
||
|
{
|
||
|
int i;
|
||
|
for(i=30;i>=1;i--) printf(" ");
|
||
|
printf("1.Input\n");
|
||
|
for(i=30;i>=1;i--) printf(" ");
|
||
|
printf("2.Output\n");
|
||
|
for(i=30;i>=1;i--) printf(" ");
|
||
|
printf("3.Order\n");
|
||
|
for(i=30;i>=1;i--) printf(" ");
|
||
|
printf("1.Quit\n");
|
||
|
char x;
|
||
|
scanf("%c",&x);
|
||
|
switch(x)
|
||
|
{
|
||
|
case 'i':printf("Please input info of the three students:");break;
|
||
|
case 'm':printf("You are trying to Make tings Ordered");break;
|
||
|
case 'q':printf("You are about to Quit");break;
|
||
|
default:printf("Wrong Input");
|
||
|
}
|
||
|
float sum=0,a[16];
|
||
|
for(i=1;i<=12;i++)
|
||
|
{
|
||
|
scanf("%f",&a[i]);
|
||
|
}
|
||
|
for(i=1;i<=12;i++)
|
||
|
{
|
||
|
if(i!=1&&i!=5&&i!=9)
|
||
|
sum+=a[i];
|
||
|
if(i%4==0)
|
||
|
{
|
||
|
a[12+i/4]=sum;
|
||
|
sum=0;
|
||
|
}
|
||
|
}
|
||
|
if(a[13]>=a[14]&&a[13]>=a[15]&&a[14]>=a[15])
|
||
|
{
|
||
|
for(i=1;i<=12;i++)
|
||
|
{
|
||
|
if(i==1||i==5||i==9)
|
||
|
printf("%5.0f",a[i]);
|
||
|
else
|
||
|
{
|
||
|
if(i%4==0)
|
||
|
{
|
||
|
printf(",%0.1f",a[12+i/4]);
|
||
|
printf(",%0.1f",a[12+i/4]/3);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
if(a[13]>=a[14]&&a[13]>=a[15]&&a[15]>=a[14])
|
||
|
{
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[5],a[14],a[14]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[9],a[15],a[15]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[1],a[13],a[13]/3);
|
||
|
}
|
||
|
if(a[13]>=a[14]&&a[13]>=a[15]&&a[14]>=a[15])
|
||
|
{
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[9],a[15],a[15]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[5],a[14],a[14]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[1],a[13],a[13]/3);
|
||
|
}
|
||
|
if(a[14]>=a[13]&&a[14]>=a[15]&&a[13]>=a[15])
|
||
|
{
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[9],a[15],a[15]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[1],a[13],a[13]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[5],a[14],a[14]/3);
|
||
|
}
|
||
|
if(a[14]>=a[13]&&a[14]>=a[15]&&a[15]>=a[13])
|
||
|
{
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[1],a[13],a[13]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[9],a[15],a[15]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[5],a[14],a[14]/3);
|
||
|
}
|
||
|
if(a[15]>=a[13]&&a[15]>=a[14]&&a[14]>=a[13])
|
||
|
{
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[1],a[13],a[13]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[5],a[14],a[14]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[9],a[15],a[15]/3);
|
||
|
}
|
||
|
if(a[15]>=a[13]&&a[15]>=a[14]&&a[13]>=a[14])
|
||
|
{
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[5],a[14],a[14]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[1],a[13],a[13]/3);
|
||
|
printf("%5.0f%,%0.1f,%0.1f\n",a[9],a[15],a[15]/3);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|