push
This commit is contained in:
parent
7848af3fe6
commit
53cca3553b
@ -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 0;
|
||||
if (uzol->ano == NULL && uzol->nie == NULL) return 1;
|
||||
return spocitaj_listy(uzol->ano) + spocitaj_listy(uzol->nie);
|
||||
}
|
||||
|
||||
@ -61,17 +61,24 @@ void spusti_system(struct strom* uzol) {
|
||||
}
|
||||
|
||||
if (odpoved[0] == 'a') {
|
||||
spusti_system(uzol->nie);
|
||||
} else if (odpoved[0] == 'n') {
|
||||
spusti_system(uzol->ano);
|
||||
} else if (odpoved[0] == 'n') {
|
||||
spusti_system(uzol->nie);
|
||||
} else {
|
||||
printf("Chybny vstup.\n");
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
struct strom* koren = nacitaj_strom();
|
||||
|
||||
if (koren) {
|
||||
printf("koren: %s", koren->hodnota);
|
||||
printf("ano: %s", koren->ano ? koren->ano->hodnota : "NULL\n");
|
||||
printf("nie: %s", koren->nie ? koren->nie->hodnota : "NULL\n");
|
||||
}
|
||||
|
||||
if (koren == NULL) {
|
||||
printf("Chyba: nepodarilo sa nacitat bazu pravidiel.\n");
|
||||
return 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user