#670
Preordine
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 | #57597452 | Utilizator | |
Fișier | preordine.cpp | Dimensiune | 848 B |
Data încărcării | 07 Aprilie 2025, 09:16 | Scor / rezultat | Eroare de compilare |
preordine.cpp:4:24: error: expected ',' or '...' before ':' token Nod(int val:val(val),st(nullptr),dr(nullptr)}; ^ preordine.cpp:4:57: error: expected ')' before '}' token Nod(int val:val(val),st(nullptr),dr(nullptr)}; ^ preordine.cpp:4:56: error: expected ';' at end of member declaration Nod(int val:val(val),st(nullptr),dr(nullptr)}; ^ preordine.cpp: In function 'void preordine(Nod*, std::ofstream&)': preordine.cpp:9:25: error: expected ')' before ';' token preordine(rad->st;out); ^ preordine.cpp:9:29: error: expected ';' before ')' token preordine(rad->st;out); ^ preordine.cpp:9:30: warning: statement has no effect [-Wunused-value] preordine(rad->st;out); ^ preordine.cpp:10:26: error: expected ')' before ';' token preordine(rad->dr;out); ^ preordine.cpp:10:30: error: expected ';' before ')' token preordine(rad->dr;out); ^ preordine.cpp:10:31: warning: statement has no effect [-Wunused-value] preordine(rad->dr;out); ^ preordine.cpp: In function 'int main()': preordine.cpp:19:20: error: no matching function for call to 'Nod::Nod()' Nod arbore[n+1]; ^ preordine.cpp:19:20: note: candidates are: preordine.cpp:4:13: note: Nod::Nod(int) Nod(int val:val(val),st(nullptr),dr(nullptr)}; ^ preordine.cpp:4:13: note: candidate expects 1 argument, 0 provided preordine.cpp:3:9: note: constexpr Nod::Nod(const Nod&) struct Nod {int val; int st; int dr; ^ preordine.cpp:3:9: note: candidate expects 1 argument, 0 provided preordine.cpp:3:9: note: constexpr Nod::Nod(Nod&&) preordine.cpp:3:9: note: candidate expects 1 argument, 0 provided preordine.cpp:25:10: error: 'noduri' was not declared in this scope noduri[i]=new Nod(val);} ^ preordine.cpp:28:10: error: 'noduri' was not declared in this scope noduri[i]->st=noduri[st[i]]; ^ preordine.cpp:30:10: error: 'noduri' was not declared in this scope noduri[i]->dr=noduri[st[i]];} ^ preordine.cpp:32:11: error: 'noduri' was not declared in this scope Nod* rad= noduri[1]; ^ preordine.cpp:19:10: warning: unused variable 'arbore' [-Wunused-variable] Nod arbore[n+1]; ^
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ă.