Оновити 'cv5/program.c'
This commit is contained in:
parent
e60a359b7a
commit
67575827e3
@ -3,7 +3,6 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#define SIZE 100
|
||||
|
||||
struct student {
|
||||
char name[SIZE];
|
||||
int votes;
|
||||
@ -42,6 +41,7 @@ int main(){
|
||||
memset(databaza,0,SIZE*sizeof(struct student));
|
||||
int size = 0;
|
||||
while(fgets(line,SIZE,stdin) && line[0] != '\n'){
|
||||
memset(name,0,SIZE);
|
||||
if(line == NULL){
|
||||
break;
|
||||
}
|
||||
@ -72,6 +72,7 @@ int main(){
|
||||
counter++;
|
||||
}
|
||||
counter--;
|
||||
qsort(databaza, size, sizeof(struct student), compare_names);
|
||||
qsort(databaza, size, sizeof(struct student), compare_votes);
|
||||
printf("Vysledky:\n");
|
||||
for(int i = 0; i < size; i++) {
|
||||
@ -79,4 +80,4 @@ int main(){
|
||||
printf("%d %s\n", databaza[i].votes, databaza[i].name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user