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 position = -1;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
bubblesort(grades_array,students_number);
|
/*bubblesort(grades_array,students_number);*/
|
||||||
for(i = students_number-1; i >= 0; i--)
|
for(i = students_number-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
if(grades_array[i] == student_grade)
|
if(grades_array[i] == student_grade)
|
||||||
@ -66,7 +66,10 @@ int find_rank_student(int student_grade, int* grades_array, int students_number)
|
|||||||
}
|
}
|
||||||
return position;
|
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)
|
void sort_students(int** students_rank, int** students_array, int students_number, int grades_number)
|
||||||
{
|
{
|
||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
@ -77,7 +80,8 @@ void sort_students(int** students_rank, int** students_array, int students_numbe
|
|||||||
{
|
{
|
||||||
grades[j] = students_array[j][i];
|
grades[j] = students_array[j][i];
|
||||||
}
|
}
|
||||||
bubblesort(grades,students_number);
|
//bubblesort(grades,students_number);
|
||||||
|
heapsort(grades,students_number);
|
||||||
for(j = 0; j < students_number; j++)
|
for(j = 0; j < students_number; j++)
|
||||||
{
|
{
|
||||||
students_rank[j][i] = find_rank_student(students_array[j][i],grades,students_number);
|
students_rank[j][i] = find_rank_student(students_array[j][i],grades,students_number);
|
||||||
@ -108,7 +112,7 @@ int main(int argc, char** argv)
|
|||||||
generate_grades(student_grades,students_length,grades_length);
|
generate_grades(student_grades,students_length,grades_length);
|
||||||
generate_ranks(student_ranks,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)
|
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