test
This commit is contained in:
parent
b83500591d
commit
c9a74987d0
7
anketa.c
7
anketa.c
@ -45,7 +45,12 @@ int add_student(struct student* students, const char* name, int votes){
|
||||
int compare(const void* s1,const void* s2){
|
||||
struct student* stud1=(struct student*)s1;
|
||||
struct student* stud2=(struct student*)s2;
|
||||
return stud1->votes==stud2->votes?0:stud1->votes<stud2->votes?1:-1;
|
||||
if(stud1->votes==stud2->votes){
|
||||
return 0;
|
||||
}else if(stud1->votes<stud2->votes){
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void sort_students(struct student* students){
|
||||
|
1
main.c
1
main.c
@ -30,6 +30,7 @@ int main(int argc,char** argv){
|
||||
case 'p': print_students(students);
|
||||
break;
|
||||
case 'o': sort_students(students);
|
||||
print_students(students);
|
||||
break;
|
||||
case 'c': count_votes(students);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user