Update 'cv8/program.c'

This commit is contained in:
Anzhelika Nikolaieva 2023-11-24 22:14:16 +00:00
parent 1f68678676
commit b488232679

View File

@ -3,7 +3,6 @@
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#define SIZE 256 #define SIZE 256
struct tree { struct tree {
@ -12,7 +11,6 @@ struct tree {
struct tree* right; struct tree* right;
}; };
struct tree* read_tree(int* counter); struct tree* read_tree(int* counter);
void destroy_tree(struct tree* tree); void destroy_tree(struct tree* tree);
void print_tree(struct tree* tree, int offset); void print_tree(struct tree* tree, int offset);
@ -50,7 +48,7 @@ void destroy_tree(struct tree* tree) {
void print_tree(struct tree* tree, int offset) { void print_tree(struct tree* tree, int offset) {
for (int i = 0; i < offset; i++) { for (int i = 0; i < offset; i++) {
//printf(" "); printf(" ");
} }
printf("%s", tree->v); printf("%s", tree->v);
if (tree->left) { if (tree->left) {
@ -96,17 +94,17 @@ void knowledge_system(struct tree* node) {
return; return;
} }
printf("%s", node->v);
if (node->left == NULL && node->right == NULL) { if (node->left == NULL && node->right == NULL) {
printf("%s", node->v);
printf("Koniec\n"); printf("Koniec\n");
return; return;
} }
printf("%s", node->v);
printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n"); printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");
char response; char response;
do { do {
printf("%s", node->v);
scanf(" %c", &response); scanf(" %c", &response);
if (response != 'a' && response != 'n') { if (response != 'a' && response != 'n') {
printf("Nespravny vstup\n"); printf("Nespravny vstup\n");