osetrit zly vstup
This commit is contained in:
parent
3e4f77dd18
commit
a9d8b04403
@ -36,7 +36,10 @@ int main() {
|
|||||||
|
|
||||||
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) break;
|
if (sscanf(vstup, "%d %[^\n]", &hlasy, name) != 2) {
|
||||||
|
printf("Nepodarilo sa nacitat nic\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
existuje = 0;
|
existuje = 0;
|
||||||
for (int i = 0; i < velkost_zoznamu; i++) {
|
for (int i = 0; i < velkost_zoznamu; i++) {
|
||||||
if (strcmp (name, studenti[i].name) == 0) {
|
if (strcmp (name, studenti[i].name) == 0) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user