#include "anketa.h" #include #include void count_votes(struct student* students){ int sum=0; for(int i=0;i1){ FILE* fr=fopen(argv[1],"r"); read_students(fr,students); switch(argv[2][1]){ case 'h': printf("-h vypise navod na ovladanie.\n-s vyhlada zadane meno.\n-p vypise vyslednu databazu mien.\n-o zotriedi vyslednu databazu podla pocetnosti.\n-c vypise pocet vsetkych odovzdanych hlasov.\n-i vypise pocet studentov, ktori dostali aspon jeden hlas.\n"); break; case 's': index=search(students,argv[3]); if(index!=-1){ printf("%s\n %d\n", students[index].name, students[index].votes); }else{ printf("Hladany student sa nenasiel.\n"); } break; case 'p': print_students(students); break; case 'o': sort_students(students); print_students(students); break; case 'c': count_votes(students); break; case 'i': printf("%d\n", count_students(students)); break; } } /* int sz = count_students(students); if (sz <= 0){ // Nenacitalo sa nic return 0; } print_students(students);*/ return 0; }