From 9f4c3725473824f2b6f9f3c97ba5fdc13df8386a Mon Sep 17 00:00:00 2001 From: Kozar Date: Sun, 10 Nov 2024 16:16:10 +0000 Subject: [PATCH] Initializacia --- cv7/program.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cv7/program.c b/cv7/program.c index 1394895..0f33b8b 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -51,9 +51,11 @@ void run_tree(struct tree* tree) { printf("%s\n", tree->value); char response; - if (scanf(" %c", &response) != 1 || (response != 'a' && response != 'n')) { - error_flag = 1; + if (scanf(" %c", &response) != 1) { + printf("Chybna databaza\n"); return; + } else if (response != 'a' && response != 'n'){ + printf("Nerozumiem\n"); } if (response == 'a') { @@ -99,10 +101,6 @@ int main() { run_tree(root); - if (error_flag) { - printf("Chybna databaza\n"); - } - destroy_tree(root); return 0; }