#include
Void sort (double a [], int n);
Double STD (double [] a);
Double GPA (double, double);
Int main ()
{
Double s [10], c [5], gpa [10].
int i,j;
Printf (" please enter a five course credits in turn: \ n ");
for(i=0; I<5; I++)
Lf the scanf (" % ", & amp; [I] c);
Printf (" please input in turn ten students' score: five courses \ n ");
for(j=0; J<10; J++)
{the for (I=0; I<5; I++)
Lf the scanf (" % ", & amp; S [j]);
Printf (" lf the classmate GPA: % \ n ", GPA (s, c)); }
Printf (" please input will get ten GPA: \ n ");//will calculate the input ten results assigned to gpa array
for(j=0; J<10; J++)
Lf the scanf (" % ", & amp; Gpa [j]);
Sort (gpa, 10);
Printf (" ten students GPA scores from high to low sorted as follows: \ n ");
for(j=0; J<10; J++)
Printf (" % lf \ n ", gpa [j]);
Printf (" lf class classmate GPA standard deviation is: % \ n ", STD (GPA));
return 0;
}
Double GPA (double s [5], a double c [5])//conversion grade point
{
int i;
Double n;
for(i=0; I<5; I++)
{
If (s [I] & gt;=96 & amp; & S [I]
=100)S [I]=4.8;
Else if (s [I] & gt;=93 & amp; & S [I]
=95)S [I]=4.5;
Else if (s [I] & gt;=90 & amp; & S [I]
=92)S [I]=4.0;
Else if (s [I] & gt;=86 & amp; & S [I]
=89)S [I]=3.8;
Else if (s [I] & gt;=83 & amp; & S [I]
=85)S [I]=3.5;
Else if (s [I] & gt;=80 & amp; & S [I]
=82)S [I]=3.0;
Else if (s [I] & gt;=76 & amp; & S [I]
=79)S [I]=2.8;
Else if (s [I] & gt;=73 & amp; & S [I]
=75)S [I]=2.5;
Else if (s [I] & gt;=70 & amp; & S [I]
=72)S [I]=2.0;
Else if (s [I] & gt;=66 & amp; & S [I]
=69)S [I]=1.8;
Else if (s [I] & gt;=63 & amp; & S [I]
=65)S [I]=1.5;
Else if (s [I] & gt;=60 & amp; & S [I]
=62)S [I]=1.0;
Else if (s [I] <[I] 60) s=0;
}
N=(s [0] * c [0] + [1] * s c [1] [2] * c + s [2] [3] [3] * c + s + s [4] [4] * c)/(c [0] + [1] c + c [2] [3] + c + c [4]);
return n;
}
Void sort (double a [], int n)//bubble sort method ten students grade point from high to low order
{
Int I, j, t;
for(j=0; J<10; J++)
for(i=0; I<9 - j; I++)
If (a [I] {t=a, [I]. A [I]=a, [I + 1]. A [I + 1]=t; }
}
Double STD (double [] a)//ask ten students grade point standard deviation
{
Double sum1=0, ave, e=0, STDD;
int i;
for(i=0; I<10; I++)
Sum1=sum1 + gpa [I];
Ave=sum1/10;
for(i=0; I<10; I++)
E +=(gpa [I] - ave) * (gpa [I] - ave);
STDD=SQRT (e/10);
Return STDD;
}
Problem is mainly out of the standard deviation of STD in o son function, and the main function in the process of the GPA son function called inside!!!!!! Please!! Of little women no choice!!
CodePudding user response:
You have to clarify specific issues to look goodCodePudding user response:
Double STD (double [] a)//ask ten students grade point standard deviation{
Double sum1=0, ave, e=0, STDD;
int i;
for(i=0; I<10; I++)
Sum1=sum1 + gpa [I];===& gt;> The incoming is an array, a gpa here [] array is where
Ave=sum1/10;
for(i=0; I<10; I++)
E +=(gpa [I] - ave) * (gpa [I] - ave);
STDD=SQRT (e/10);
Return STDD;
}