This commit is contained in:
Matus Tokarcik 2024-03-21 19:13:33 +01:00
parent ae383fb1d4
commit c28dff4800
2 changed files with 9 additions and 1 deletions

View File

@ -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;
}

Binary file not shown.