From 63c45f8e6527d637faa98a02ed7faac2965998a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Vl=C4=8Dek?= Date: Wed, 15 Apr 2026 09:42:52 +0000 Subject: [PATCH] Aktualizovat du5/program.c --- du5/program.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/du5/program.c b/du5/program.c index 751fced..b0849ab 100644 --- a/du5/program.c +++ b/du5/program.c @@ -36,14 +36,22 @@ int buildATree() char *line = lines[indexLine]; indexLine += 1; //pomocny index - int current = nodeCount++; + int current = nodeCount += 1; if (line[0] == '*') { tree[current].isAnswer = true; strcpy(tree[current].text, line + 1); tree[current].yes = invalidIndex; tree[current].no = invalidIndex; - //rekurzivne vytvorii dalsie 'nodes' (uzly po slovensky) na na zaklade vycitanych odpovedi z standard inputu + + answerCount += 1; + return current; + } + + tree[current].isAnswer = false; + strcpy(tree[current].text, line); + + //rekurzivne vytvorii dalsie 'nodes' (uzly po slovensky) na na zaklade vycitanych odpovedi z standard inputu tree[current].yes = buildATree(); // 'a' tree[current].no = buildATree(); // 'n' @@ -123,11 +131,6 @@ int main() goThroughTheTree(root); return 0; -} answerCount += 1; - return current; - } - - tree[current].isAnswer = false; - strcpy(tree[current].text, line); +} \ No newline at end of file