diff --git a/student_rank.C b/student_rank.C new file mode 100644 index 0000000..a2ed843 --- /dev/null +++ b/student_rank.C @@ -0,0 +1,19 @@ +#include +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 + } +}