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