From 824fcb68dd0466ced4881bd2e2c4ae385c9d6a12 Mon Sep 17 00:00:00 2001 From: Nadou Emmanuella LAWSON-LARTEGO Date: Tue, 3 Dec 2024 18:56:29 +0100 Subject: [PATCH] =?UTF-8?q?T=C3=A9l=C3=A9verser=20les=20fichiers=20vers=20?= =?UTF-8?q?"/"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- student_rank.C | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 student_rank.C 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 + } +}