From 2e3c820cc90d2981d489d3def69b63097e3d3e6b Mon Sep 17 00:00:00 2001 From: vj586da Date: Fri, 26 Nov 2021 03:00:27 +0100 Subject: [PATCH] 4. commit --- cv8/program.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cv8/program.c b/cv8/program.c index bba71c6..39a25ec 100644 --- a/cv8/program.c +++ b/cv8/program.c @@ -55,11 +55,15 @@ void ask(struct node* tree){ printf("%s", tree->data); if(tree->data[0] == '*'){ puts("Koniec"); + return; } - if(tree->left != NULL){ + char buff[SIZE]; + char* r = fgets(buff, SIZE, stdin); + r = fgets(buff, SIZE, stdin); + if(r[0] == 'a' && tree->left != NULL){ tree = tree->left; ask(tree); - }else if(tree->right != NULL) { + }else if(r[0] == 'n' && tree->right != NULL) { tree = tree->right; ask(tree); }else{