#670
Se dă un arbore binar care conține valori numere naturale. Să se afișeze valorile din arbore în urma parcurgerii în preordine.
Problema | Preordine | Operații I/O |
![]() preordine.in /preordine.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57435550 | Utilizator | |
Fișier | preordine.cpp | Dimensiune | 677 B |
Data încărcării | 31 Martie 2025, 12:38 | Scor / rezultat | Eroare de compilare |
preordine.cpp:3:13: error: variable 'std::ifstream fin' has initializer but incomplete type ifstream fin("preordine.in"); ^ preordine.cpp:4:14: error: variable 'std::ofstream fout' has initializer but incomplete type ofstream fout("preordine.out"); ^ preordine.cpp:8:5: error: 'info' does not name a type info, st,dr; ^ preordine.cpp: In function 'void read()': preordine.cpp:16:19: error: 'struct nod' has no member named 'info' fin<<z[i].info<<z[i].st<<z[i].dr; ^ preordine.cpp:16:30: error: 'struct nod' has no member named 'st' fin<<z[i].info<<z[i].st<<z[i].dr; ^ preordine.cpp:16:39: error: 'struct nod' has no member named 'dr' fin<<z[i].info<<z[i].st<<z[i].dr; ^ preordine.cpp:17:10: error: no match for 'operator[]' (operand types are 'int [1001]' and 'nod') v[z[i]].st=v[z[i]].dr=1; ^ preordine.cpp:17:21: error: no match for 'operator[]' (operand types are 'int [1001]' and 'nod') v[z[i]].st=v[z[i]].dr=1; ^ preordine.cpp: In function 'void preordine(int)': preordine.cpp:22:18: error: 'struct nod' has no member named 'info' fout<<z[nod].info<<" "; ^ preordine.cpp:23:15: error: 'struct nod' has no member named 'st' if(z[nod].st) ^ preordine.cpp:24:21: error: 'struct nod' has no member named 'st' prordine(z[nod].st); ^ preordine.cpp:24:23: error: 'prordine' was not declared in this scope prordine(z[nod].st); ^ preordine.cpp:25:15: error: 'struct nod' has no member named 'dr' if(z[nod].dr) ^ preordine.cpp:26:22: error: 'struct nod' has no member named 'dr' preordine(z[nod].dr); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Preordine 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ă.