Home > Back-end >  About having both ability and political theory of test point 2 error
About having both ability and political theory of test point 2 error

Time:09-30

#include
#include
#include
Struct stu
{
Char num [9].
Int D_grade;
Int C_grade;
Int sum;
};
Void sort (struct stu a [], int n)
{
For (int I=0; i {
For (int j=0; J & lt; N - I - 1; J++)
{
If (a [j] sum & lt; + 1 a [j].journal of the sum)
{
Struct stu temp=a, [j].
A [j]=a, a + 1 bonus to [j].
A=\ [j + 1];
}
}
}
For (int I=0; i {
If (a [I] sum==a [I + 1] sum)//total same DE 55-25)
{
If (a [I] D_grade==a [I + 1] D_grade)
{
If (STRCMP (a [I] num, a [I + 1] num) & gt; 0)
{
Struct stu temp=a, [I].
A [I]=a, [I + 1].
A=\ [I + 1];
}
}
If (a [I] D_grade & lt; A [I + 1] D_grade)//total score the same points high
{
Struct stu temp=a, [I].
A [I]=a, [I + 1].
A=\ [I + 1];
}
}
}
For (int I=0; i {
Printf (" \ n % s % d % d ", a [I] num, a [I] D_grade, a [I] C_grade);
}
}
Int main ()
{
Int N, L, H;
Int k1=0, k2=0, k3=0, k4=0, flag=0;
The scanf (" % d % d % d ", & amp; N, & amp; L, & amp; H);
Struct stu * stu1;
Struct stu * s1, s2, s3, * s4.
Stu1=(struct stu *) malloc (sizeof (struct stu) * N);
S1=(struct stu *) malloc (sizeof (struct stu) * N);
S2=(struct stu *) malloc (sizeof (struct stu) * N);
S3=(struct stu *) malloc (sizeof (struct stu) * N);
S4=(struct stu *) malloc (sizeof (struct stu) * N);
for (int i=0; I{
The scanf (" % s % d % d ", & amp; Stu1 [I]. Num, & amp; Stu1 [I]. D_grade, & amp; Stu1 [I] C_grade);
}
for (int i=0; i {
If (stu1 [I] D_grade & gt;=L & amp; & Stu1 [I] C_grade & gt;=L)
{
If (stu1 [I] D_grade & gt;=H & amp; & Stu1 [I] C_grade & gt;=H)//first class good all do
{
Stu1 [I] sum=stu1 [I] D_grade + stu1 [I] C_grade;
S1=[k1 + +] stu1 [I];
}
If (stu1 [I] D_grade & gt;=H & amp; & Stu1 [I] C_grade & lt; H)//the second category of DE - only
{
Stu1 [I] sum=stu1 [I] D_grade + stu1 [I] C_grade;
S2/k2 + +=stu1 [I];
}
If (stu1 [I] D_grade & lt; H & amp; & Stu1 [I] C_grade & lt; H & amp; & Stu1 [I] D_grade & gt;=stu1 [I] C_grade)//third kind good wu
{
Stu1 [I] sum=stu1 [I] D_grade + stu1 [I] C_grade;
S3 [k3 + +]=stu1 [I];
}
If (stu1 [I] D_grade & lt; Stu1 [I] C_grade & amp; & Stu1 [I] D_grade & lt; H)//class 4 other
{
Stu1 [I] sum=stu1 [I] D_grade + stu1 [I] C_grade;
S4=stu1 [k4 + +] [I];
}
}
}
Printf (" % d ", k1, k2 and k3 + k4);
Sort (s1, k1);
Sort (s2, k2);
Sort (s3, k3);
Sort (s4, k4);
return 0;
}

CodePudding user response:

//the scanf (" % s % d % d ", & amp; Stu1 [I]. Num, & amp; Stu1 [I]. D_grade, & amp; Stu1 [I] C_grade); 
The scanf (" % s % d % d ", stu1 [I] num, & amp; Stu1 [I]. D_grade, & amp; Stu1 [I] C_grade);

For your reference ~
  • Related