1s
This commit is contained in:
parent
36a36be66e
commit
d7cecb13a7
@ -11,14 +11,14 @@ struct tree{
|
||||
};
|
||||
|
||||
struct tree* read_tree(){
|
||||
char buffer[SIZE];
|
||||
if(!fgets(buffer,SIZE,stdin)) return NULL;
|
||||
if(buffer[0]=='\n') return NULL;
|
||||
char b[SIZE];
|
||||
if(!fgets(b,SIZE,stdin)) return NULL;
|
||||
if(b[0]=='\n') return NULL;
|
||||
struct tree* t=malloc(sizeof(struct tree));
|
||||
strcpy(t->text,buffer);
|
||||
strcpy(t->text,b);
|
||||
t->yes=NULL;
|
||||
t->no=NULL;
|
||||
if(buffer[0]=='*') return t;
|
||||
if(b[0]=='*') return t;
|
||||
t->yes=read_tree();
|
||||
t->no=read_tree();
|
||||
return t;
|
||||
@ -38,12 +38,13 @@ int count_items(struct tree* t){
|
||||
}
|
||||
|
||||
void run_chatbot(struct tree* t){
|
||||
printf("%s",t->text);
|
||||
if(t->text[0]=='*'){
|
||||
printf("%s",t->text);
|
||||
printf("Koniec\n");
|
||||
return;
|
||||
}
|
||||
printf("Odpovedajte 'a' pre prvu moznost alebo 'n' pre druhu moznost.\n");
|
||||
printf("%s",t->text);
|
||||
char c;
|
||||
if(scanf(" %c",&c)!=1){
|
||||
printf("Chyba vstupu.\n");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user