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,22 +20,32 @@ 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);
if (r == NULL) { if (r == NULL) {
break; break;
} }
if (strcmp(line, "\n") == 0) { if (strcmp(line, "\n") == 0) {
continue; continue;
} }
int value = strtol(line, NULL, 10); int value = strtol(line, NULL, 10);
if (value == 0) { if (value == 0) {
break; if (prvy_vstup) {
printf("Nepodarilo nacitat nic.\n");
return 0;
} else {
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;