#753
Preordine1
Se consideră un arbore binar în care nodurile memorează numere naturale nenule. Să se afișeze valorile memorate în subarborele stâng al rădăcinii în urma parcurgerii în preordine.
Problema | Preordine1 | Operații I/O |
![]() preordine1.in /preordine1.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57163463 | Utilizator | |
Fișier | preordine1.cpp | Dimensiune | 567 B |
Data încărcării | 18 Martie 2025, 19:19 | Scor / rezultat | Eroare de compilare |
preordine1.cpp:8:9: error: field 'st' has incomplete type nod st,dr; ^ preordine1.cpp:8:12: error: field 'dr' has incomplete type nod st,dr; ^ preordine1.cpp: In function 'void RSD(nod)': preordine1.cpp:12:9: error: could not convert 'p' from 'nod' to 'bool' if(p) ^ preordine1.cpp:14:19: error: base operand of '->' has non-pointer type 'nod' fout << p -> info << " "; ^ preordine1.cpp:15:14: error: base operand of '->' has non-pointer type 'nod' RSD(p->st); ^ preordine1.cpp:16:14: error: base operand of '->' has non-pointer type 'nod' RSD(p->dr); ^ preordine1.cpp: In function 'void read(nod&)': preordine1.cpp:23:18: error: no match for 'operator=' (operand types are 'nod' and 'int') if(x == 0) p = NULL; ^ preordine1.cpp:23:18: note: candidates are: preordine1.cpp:5:8: note: nod& nod::operator=(const nod&) struct nod ^ preordine1.cpp:5:8: note: no known conversion for argument 1 from 'int' to 'const nod&' preordine1.cpp:5:8: note: nod& nod::operator=(nod&&) preordine1.cpp:5:8: note: no known conversion for argument 1 from 'int' to 'nod&&' preordine1.cpp:26:11: error: no match for 'operator=' (operand types are 'nod' and 'nod*') p = new nod; ^ preordine1.cpp:26:11: note: candidates are: preordine1.cpp:5:8: note: nod& nod::operator=(const nod&) struct nod ^ preordine1.cpp:5:8: note: no known conversion for argument 1 from 'nod*' to 'const nod&' preordine1.cpp:5:8: note: nod& nod::operator=(nod&&) preordine1.cpp:5:8: note: no known conversion for argument 1 from 'nod*' to 'nod&&' preordine1.cpp:27:10: error: base operand of '->' has non-pointer type 'nod' p->info = x; ^ preordine1.cpp:28:16: error: base operand of '->' has non-pointer type 'nod' read(p -> st); ^ preordine1.cpp:29:16: error: base operand of '->' has non-pointer type 'nod' read(p -> dr); ^ preordine1.cpp: In function 'int main()': preordine1.cpp:35:11: error: invalid initialization of reference of type 'nod&' from expression of type 'nod*' read(p); ^ preordine1.cpp:19:6: error: in passing argument 1 of 'void read(nod&)' void read(nod &p) ^ preordine1.cpp:36:14: error: 'struct nod' has no member named 'st' RSD(p -> st); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Preordine1 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.