forked from menault/TD4_DEV51_Qualite_Algo
Téléverser les fichiers vers "/"
This commit is contained in:
parent
328f59d821
commit
824fcb68dd
19
student_rank.C
Normal file
19
student_rank.C
Normal file
@ -0,0 +1,19 @@
|
||||
#include <stdlib.h>
|
||||
void sort_students(int** students_rank, int** students_array, int students_number, int grades_number)
|
||||
{
|
||||
int i = 0, j = 0;
|
||||
for(i = 0; i < grades_number; i++) // boucle sur les matières
|
||||
{
|
||||
int * grades = (int*) malloc(students_number*sizeof(int)); // allocation de mémoire
|
||||
for(j = 0; j < students_number; j++) // boucle sur les étudiants
|
||||
{
|
||||
grades[j] = students_array[j][i]; // copie des notes
|
||||
}
|
||||
bubblesort(grades,students_number); // tri des notes
|
||||
for(j = 0; j < students_number; j++) // attribution du rang
|
||||
{
|
||||
students_rank[j][i] = find_rank_student(students_array[j][i],grades,students_number); // recherche du rang
|
||||
}
|
||||
free(grades); // libération de la mémoire allouée
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user