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.
137 lines
2.3 KiB
137 lines
2.3 KiB
1 year ago
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
int main()
|
||
|
{
|
||
|
float stu4[6];
|
||
|
int i,j,x;
|
||
|
float stu1[6]={10001,11,99.5,88.5,89.5,0},
|
||
|
stu2[6]={10002,12,77.9,56.5,87.5,0},
|
||
|
stu3[6]={10003,11,92.5,99.0,60.5,0};
|
||
|
stu4[5]=0;
|
||
|
for(i=0;i<5;i++)
|
||
|
{
|
||
|
stu1[5]=stu1[5]+stu1[i];
|
||
|
stu2[5]=stu2[5]+stu2[i];
|
||
|
stu3[5]=stu3[5]+stu3[i];
|
||
|
scanf("%f",&stu4[i]);
|
||
|
stu4[5]=stu4[5]+stu4[i];
|
||
|
}
|
||
|
x=stu4[0];
|
||
|
void swap(float a[],float b[]);
|
||
|
swap (stu1,stu2);
|
||
|
swap (stu1,stu3);
|
||
|
swap (stu1,stu4);
|
||
|
swap (stu2,stu3);
|
||
|
swap (stu2,stu4);
|
||
|
swap (stu3,stu4);
|
||
|
void swa(float a[],float b[]);
|
||
|
if(stu1[1]==stu2[1]&&stu2[1]<stu3[1])
|
||
|
{
|
||
|
swa(stu1,stu2);
|
||
|
}
|
||
|
else
|
||
|
if(stu1[1]==stu2[1]&&stu2[1]==stu3[1]&&stu3[1]<stu4[1])
|
||
|
{
|
||
|
swa(stu1,stu2);
|
||
|
swa(stu1,stu3);
|
||
|
swa(stu2,stu3);
|
||
|
}
|
||
|
else
|
||
|
if(stu1[1]==stu2[1]&&stu2[1]==stu3[1]&&stu3[1]==stu4[1])
|
||
|
{
|
||
|
swa (stu1,stu2);
|
||
|
swa (stu1,stu3);
|
||
|
swa (stu1,stu4);
|
||
|
swa (stu2,stu3);
|
||
|
swa (stu2,stu4);
|
||
|
swa (stu3,stu4);
|
||
|
}
|
||
|
|
||
|
if(stu1[1]<stu2[1])
|
||
|
{
|
||
|
if(stu2[1]==stu3[1]&&stu3[1]<stu4[1])
|
||
|
{
|
||
|
swa(stu2,stu3);
|
||
|
}
|
||
|
else
|
||
|
if(stu2[1]==stu3[1]&&stu3[1]==stu4[1])
|
||
|
{
|
||
|
swa(stu2,stu3);
|
||
|
swa(stu2,stu4);
|
||
|
swa(stu3,stu4);
|
||
|
}
|
||
|
else
|
||
|
if(stu2[1]<stu3[1]&&stu3[1]<stu4[1])
|
||
|
;
|
||
|
else
|
||
|
if(stu2[1]<stu3[1]&&stu3[1]==stu4[1])
|
||
|
swa(stu3,stu4);
|
||
|
}
|
||
|
for(i=0;i<5;i++)
|
||
|
{
|
||
|
if(i>1)
|
||
|
printf("%.1f ",stu1[i]);
|
||
|
else printf("%.0f ",stu1[i]);
|
||
|
}
|
||
|
if(stu1[0]==x)
|
||
|
printf("Inserted\n");
|
||
|
else printf("\n");
|
||
|
for(i=0;i<5;i++)
|
||
|
{
|
||
|
if(i>1)
|
||
|
printf("%.1f ",stu2[i]);
|
||
|
else printf("%.0f ",stu2[i]);
|
||
|
}
|
||
|
if(stu2[0]==x)
|
||
|
printf("Inserted\n");
|
||
|
else printf("\n");
|
||
|
for(i=0;i<5;i++)
|
||
|
{
|
||
|
if(i>1)
|
||
|
printf("%.1f ",stu3[i]);
|
||
|
else printf("%.0f ",stu3[i]);
|
||
|
}
|
||
|
if(stu3[0]==x)
|
||
|
printf("Inserted\n");
|
||
|
else printf("\n");
|
||
|
for(i=0;i<5;i++)
|
||
|
{
|
||
|
if(i>1)
|
||
|
printf("%.1f ",stu4[i]);
|
||
|
else printf("%.0f ",stu4[i]);
|
||
|
}
|
||
|
if(stu4[0]==x)
|
||
|
printf("Inserted\n");
|
||
|
else printf("\n");
|
||
|
}
|
||
|
void swap(float a[],float b[])
|
||
|
{
|
||
|
int i;float s;
|
||
|
if(a[1]>b[1])
|
||
|
{
|
||
|
for(i=0;i<6;i++)
|
||
|
{
|
||
|
s=a[i];
|
||
|
a[i]=b[i];
|
||
|
b[i]=s;
|
||
|
}
|
||
|
}
|
||
|
else;
|
||
|
|
||
|
}
|
||
|
void swa(float a[],float b[])
|
||
|
{
|
||
|
int i;float s;
|
||
|
if(a[5]<b[5])
|
||
|
{
|
||
|
for(i=0;i<6;i++)
|
||
|
{
|
||
|
s=a[i];
|
||
|
a[i]=b[i];
|
||
|
b[i]=s;
|
||
|
}
|
||
|
}
|
||
|
else;
|
||
|
|
||
|
}
|