Home > Back-end >  This how to write! ? ! ? ! ?
This how to write! ? ! ? ! ?

Time:01-16

In the C language
Receive the student number variable input end click N
Enter a time assignment all
How to modify the

#include
using namespace std;
Struct students
{
Int xno;
Char name [8].
Char kcname [20].
Char field [12].
Float score;
};
Int main ()

{

Struct students temp, student [5];

int i;

Float cj.

Cj=0;

Printf (" please input students student id name course name professional title: \ n ");

for(i=0; i<5; I++)

{

Student: printf (" % d ", I + 1);

The scanf (" % d % s % s % s % f ", & amp; Student [I]. Xno, student [I]. Name, student [I] kcname, student [I] field, & amp; Cj);

Student [I]. Score=cj;

}

Printf (" \ n -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - \ n ");

for(i=0; i<5; I++)

{

Printf (" % d % s \ \ t t % s \ \ t t % s % 2 f \ n ", student [I] xno, student [I]. Name, student [I] kcname, student [I] field, student [I] score).

}
For (I=0; I & lt; 4. I++)

{

K=I;

For (j=I + 1; J & lt; 5; J++)

{

If (student [j] score & lt; Student [k]. Score)

K=j;

If (k!=I)

{

Temp=student [I];

Student [I]=student [k].

Student [k]=temp;

}

}

}

Printf (" \ n -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - \ n ");

Printf (" supreme achievement of the students are \ n ");

Printf (" % d % s \ \ t t t % s to % s \ \ t \ t % 2 f \ n ", student [4]. Xno, student [4]. The name, student [4]. Kcname, student [4]. The field, the student [4]. The score).

return 0;
}







  • Related