push
This commit is contained in:
parent
670e8d79b2
commit
7848af3fe6
@ -22,7 +22,7 @@ struct strom* nacitaj_strom() {
|
||||
struct strom* uzol = calloc(1, sizeof(struct strom));
|
||||
memcpy(uzol->hodnota, buffer, SIZE);
|
||||
|
||||
if (buffer[0] == '*') {
|
||||
if (buffer[0] != '*') {
|
||||
uzol->ano = nacitaj_strom();
|
||||
uzol->nie = nacitaj_strom();
|
||||
}
|
||||
@ -39,7 +39,7 @@ void znic_strom(struct strom* uzol) {
|
||||
|
||||
int spocitaj_listy(struct strom* uzol) {
|
||||
if (uzol == NULL) return 0;
|
||||
if (uzol->ano == NULL || uzol->nie == NULL) return 1;
|
||||
if (uzol->ano == NULL && uzol->nie == NULL) return 0;
|
||||
return spocitaj_listy(uzol->ano) + spocitaj_listy(uzol->nie);
|
||||
}
|
||||
|
||||
@ -61,9 +61,9 @@ void spusti_system(struct strom* uzol) {
|
||||
}
|
||||
|
||||
if (odpoved[0] == 'a') {
|
||||
spusti_system(uzol->ano);
|
||||
} else if (odpoved[0] == 'n') {
|
||||
spusti_system(uzol->nie);
|
||||
} else if (odpoved[0] == 'n') {
|
||||
spusti_system(uzol->ano);
|
||||
} else {
|
||||
printf("Chybny vstup.\n");
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user