TD1
This commit is contained in:
parent
ca552281c9
commit
154d0b7edb
715
contrerendu.txt
Normal file
715
contrerendu.txt
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
BIN
student_rank.exe
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user