Aktualizovat du5/program.c

This commit is contained in:
Tomáš Vlček 2026-04-15 09:42:52 +00:00
parent 7ef209f6cc
commit 63c45f8e65

View File

@ -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);
}