Aktualizovat du5/program.c
This commit is contained in:
parent
7ef209f6cc
commit
63c45f8e65
@ -36,14 +36,22 @@ int buildATree()
|
|||||||
char *line = lines[indexLine];
|
char *line = lines[indexLine];
|
||||||
indexLine += 1;
|
indexLine += 1;
|
||||||
//pomocny index
|
//pomocny index
|
||||||
int current = nodeCount++;
|
int current = nodeCount += 1;
|
||||||
|
|
||||||
if (line[0] == '*') {
|
if (line[0] == '*') {
|
||||||
tree[current].isAnswer = true;
|
tree[current].isAnswer = true;
|
||||||
strcpy(tree[current].text, line + 1);
|
strcpy(tree[current].text, line + 1);
|
||||||
tree[current].yes = invalidIndex;
|
tree[current].yes = invalidIndex;
|
||||||
tree[current].no = 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].yes = buildATree(); // 'a'
|
||||||
tree[current].no = buildATree(); // 'n'
|
tree[current].no = buildATree(); // 'n'
|
||||||
|
|
||||||
@ -123,11 +131,6 @@ int main()
|
|||||||
goThroughTheTree(root);
|
goThroughTheTree(root);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} answerCount += 1;
|
}
|
||||||
return current;
|
|
||||||
}
|
|
||||||
|
|
||||||
tree[current].isAnswer = false;
|
|
||||||
strcpy(tree[current].text, line);
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user