This commit is contained in:
Filip Chochol 2026-03-10 13:44:06 +01:00
parent 72c56a7686
commit 9fd9868695

View File

@ -3,7 +3,7 @@
#include <stdlib.h>
#define SIZE 100
struct student {
char meno[SIZE];
@ -14,6 +14,7 @@ struct student {
int najdi_studenta(struct student* studenti, int pocet, const char* meno) {
for (int i = 0; i < pocet; i++) {
if (strcmp(studenti[i].meno, meno) == 0) {
return i;
}
@ -49,8 +50,8 @@ int main() {
char* koniec = NULL;
int hodnota = (int)strtol(riadok, &koniec, 10);
if (koniec == riadok) {
continue;
if (koniec == riadok || hodnota == 0) {
break;
}
while (*koniec == ' ') {
@ -70,6 +71,7 @@ int main() {
if (zaciatok_mena[velkost_mena - 1] == '\n') {
velkost_mena--;
}
if (velkost_mena <= 0) {
continue;
}