From 1a9506f74700944c3449d87159212eca83ba035b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Vl=C4=8Dek?= Date: Mon, 30 Mar 2026 07:03:22 +0000 Subject: [PATCH] Aktualizovat a3/program.c --- a3/program.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/a3/program.c b/a3/program.c index 4e0d38a..937f0b3 100644 --- a/a3/program.c +++ b/a3/program.c @@ -1,6 +1,54 @@ #include #include +#include + +#DEFINE BUFFER_SIZE 64; +#DEFINE STUDENT_SIZE 32; + +struct studentApplication +{ + char meno[BUFFER_SIZE]; +} + +int main() +{ + int studentsAmount; + struct studentsApplication student[STUDENT_SIZE]; + int i = 0; + char processedName[BUFFER_SIZE]; + + setMemoryOfArrays(processedName, student); + + while (fgets(line, SIZE, stdin) != NULL) + { + if (studentsAmount == 0) + { + if(sscanf(line, "%d", studentsAmount) == 1) { continue; } + } + else if(sscanf(line, "%s", processedName) == 1) + { + strcpy(student[i].meno, processedName); + i++; + } + } + + if (studentsAmount == 0) + { + puts("Nespravny vstup"); + return 0; + } -int main() { return 0; -} \ No newline at end of file + +} +void setMemoryOfArrays(char* processedName, studentsApplication* student) +{ + //prednastavi pamat mnozinovych premien + processedName[0] = '\0'; + + for (int i = 0; i++; i < STUDENT_SIZE) + { + student[i].meno = '\0'; + } + +}