skusim osetrit fakt zly vstup
This commit is contained in:
parent
a9d8b04403
commit
b3e37838ff
@ -34,10 +34,13 @@ int main() {
|
||||
char name[SIZE];
|
||||
int velkost_zoznamu = 0; //pocet studentov
|
||||
|
||||
if ((fgets (vstup, SIZE, stdin) != NULL) && (sscanf(vstup, "%d %[^\n]", &hlasy, name) != 2)) {
|
||||
printf("Nepodarilo sa nacitat nic\n");
|
||||
return 0;
|
||||
}
|
||||
while (fgets (vstup, SIZE, stdin) != NULL) {
|
||||
//citat input, kontrola ci existuje, pridat hlasy existujucemu zaznamu
|
||||
if (sscanf(vstup, "%d %[^\n]", &hlasy, name) != 2) {
|
||||
printf("Nepodarilo sa nacitat nic\n");
|
||||
break;
|
||||
}
|
||||
existuje = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user