mozno 100

This commit is contained in:
Michal Utľák 2024-03-13 12:22:37 +01:00
parent 9135a8412b
commit ba05a39537

View File

@ -20,6 +20,8 @@ char line[SIZE];
int main() { int main() {
memset(databaza, 0, SIZE * sizeof(struct student)); memset(databaza, 0, SIZE * sizeof(struct student));
int prvy_vstup = 1;
while (1) { while (1) {
memset(line, 0, SIZE); memset(line, 0, SIZE);
char *r = fgets(line, SIZE, stdin); char *r = fgets(line, SIZE, stdin);
@ -34,8 +36,16 @@ int main() {
int value = strtol(line, NULL, 10); int value = strtol(line, NULL, 10);
if (value == 0) { if (value == 0) {
if (prvy_vstup) {
printf("Nepodarilo nacitat nic.\n");
return 0;
} else {
break; break;
} }
}
prvy_vstup = 0;
char name[SIZE]; char name[SIZE];
memset(name, 0, SIZE); memset(name, 0, SIZE);
char *zaciatok_mena = strchr(line, ' ') + 1; char *zaciatok_mena = strchr(line, ' ') + 1;