diff --git a/cv5/program.c b/cv5/program.c index 09e4514..7685db4 100644 --- a/cv5/program.c +++ b/cv5/program.c @@ -17,7 +17,7 @@ int find_student(struct student* students,int size, const char* name){ return i; //ak najde studenta } } - printf("nenaslo studenta\n"); // ak nenajde studenta + //printf("nenaslo studenta\n"); // ak nenajde studenta return -1; } @@ -41,12 +41,14 @@ int main(){ memset(line,0,SIZE); char* r = fgets(line,SIZE,stdin); if (r == NULL){ + return -1; } //nacitanie celeho cisla, premiena kym nepride na znak ktory nieje cislo char* end = NULL; int value = strtol(line,&end,10); if (value == 0){ + return 1; } // pomocné pole char name[SIZE]; @@ -66,6 +68,7 @@ int main(){ } else { printf( "nepodarilo sa nacitat meno \n"); +return 1; } //prejde vsetky polozky v databaze @@ -79,11 +82,16 @@ if (id< 0){ } else{ printf("databaza je plna\n"); + return 1; } } else { databaza[id].votes = value; } + printf("Vysledky:\n"); + for (int i = 0; i < size; i++){ + printf ("%d %s\n", databaza[i].votes, databaza[i].name); + } return 0; } \ No newline at end of file diff --git a/cv5/program.exe b/cv5/program.exe index 532b0ec..cd048ef 100644 Binary files a/cv5/program.exe and b/cv5/program.exe differ