From f731011901a25d23b7feb807e7a37b1a26d0751f Mon Sep 17 00:00:00 2001 From: pvl836cjw <2745453479@qq.com> Date: Mon, 13 Nov 2023 20:32:34 +0800 Subject: [PATCH] ADD file via upload --- Task4.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 Task4.c diff --git a/Task4.c b/Task4.c new file mode 100644 index 0000000..2b333d6 --- /dev/null +++ b/Task4.c @@ -0,0 +1,136 @@ +#include +#include +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]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]