This commit is contained in:
SimonSayeBabu 2024-09-03 12:19:05 +02:00
parent ca552281c9
commit 154d0b7edb
6 changed files with 731 additions and 12 deletions

715
contrerendu.txt Normal file

File diff suppressed because it is too large Load Diff

BIN
gmon.out Normal file

Binary file not shown.

BIN
out2.txt Normal file

Binary file not shown.

BIN
out3.txt Normal file

Binary file not shown.

View File

@ -55,7 +55,7 @@ int find_rank_student(int student_grade, int* grades_array, int students_number)
{
int position = -1;
int i = 0;
bubblesort(grades_array,students_number);
/*bubblesort(grades_array,students_number);*/
for(i = students_number-1; i >= 0; i--)
{
if(grades_array[i] == student_grade)
@ -66,23 +66,27 @@ int find_rank_student(int student_grade, int* grades_array, int students_number)
}
return position;
}
/* !!!!!
students_number arg 1
grades_number arg 2
*/
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++)
{
int * grades = (int*) malloc(students_number*sizeof(int));
for(j = 0; j < students_number; j++)
{
grades[j] = students_array[j][i];
}
bubblesort(grades,students_number);
for(j = 0; j < students_number; j++)
{
for(j = 0; j < students_number; j++)
{
grades[j] = students_array[j][i];
}
//bubblesort(grades,students_number);
heapsort(grades,students_number);
for(j = 0; j < students_number; j++)
{
students_rank[j][i] = find_rank_student(students_array[j][i],grades,students_number);
}
free(grades);
}
free(grades);
}
}
@ -108,7 +112,7 @@ int main(int argc, char** argv)
generate_grades(student_grades,students_length,grades_length);
generate_ranks(student_ranks,students_length,grades_length);
sort_students(student_ranks,student_grades,students_length,grades_length);
sort_students(student_ranks,student_grades,students_length,grades_length); /*!!!!!!*/
if(debug_mode)
{

BIN
student_rank.exe Normal file

Binary file not shown.