Subido por Minh Nguyễn

Task10

Anuncio
In this code, you can see that I defined the struct type student that contain many variables:
These variables store the information of students such as ID, Name, Grade, GPA
In this main function, I declared variable num_students to store the number of student that we
neet to input information
I make an if statement to check that whether the number of students bigger than 1000. If it
does, the if statement will return Error: Invalid number of students on the screen
After that, I call the function enterStudentInfor with the struct student and the declared
num_student to input the information of students
Then, I call the function swapArrange to sort the student list by GPA in descending order.
In the printf fuction of printStudentList function: “-” to help me align left; “20” help me create a
space of 20 characters also with “s” here to declare the data type of variable
The for loop is used to print out the table with the information of students
In this codes, I declare variables i, j and min
I used the bubble sort and if statement to sort the gpa of student in the descending order
Descargar