#4682
Să se scrie funcția Erase care va șterge dintr-o listă dublu înlănțuită toate nodurile care memorează numere pare. De exemplu, dacă lista reține valorile 5,3,6,2,1,8, atunci după apelul Erase(prim, ultim), lista va fi 5,3,1.
| Problema | FLdiErase | Operații I/O |
erase.in/erase.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64429793 | Utilizator | |
| Fișier | fldierase.cpp | Dimensiune | 1001 B |
| Data încărcării | 06 Mai 2026, 13:53 | Scor/rezultat | Eroare de compilare |
fldierase.cpp:19:8: error: redefinition of ‘struct nod’ 19 | struct nod{ | ^~~ fldierase.cpp:4:8: note: previous definition of ‘struct nod’ 4 | struct nod | ^~~ fldierase.cpp: In function ‘void Erase(nod*&, nod*&)’: fldierase.cpp:25:2: error: ‘ult’ was not declared in this scope; did you mean ‘ultim’? 25 | ult->ant=NULL; | ^~~ | ultim fldierase.cpp: In function ‘int main()’: fldierase.cpp:49:19: error: no matching function for call to ‘nod::nod()’ 49 | p=new nod; | ^~~ fldierase.cpp:8:5: note: candidate: ‘nod::nod(int)’ 8 | nod(int x) | ^~~ fldierase.cpp:8:5: note: candidate expects 1 argument, 0 provided fldierase.cpp:4:8: note: candidate: ‘constexpr nod::nod(const nod&)’ 4 | struct nod | ^~~ fldierase.cpp:4:8: note: candidate expects 1 argument, 0 provided fldierase.cpp:4:8: note: candidate: ‘constexpr nod::nod(nod&&)’ fldierase.cpp:4:8: note: candidate expects 1 argument, 0 provided fldierase.cpp:52:19: warning: statement has no effect [-Wunused-value] 52 | p->ant-NULL; | ^ fldierase.cpp:58:19: error: no matching function for call to ‘nod::nod()’ 58 | q=new nod; | ^~~ fldierase.cpp:8:5: note: candidate: ‘nod::nod(int)’ 8 | nod(int x) | ^~~ fldierase.cpp:8:5: note: candidate expects 1 argument, 0 provided fldierase.cpp:4:8: note: candidate: ‘constexpr nod::nod(const nod&)’ 4 | struct nod | ^~~ fldierase.cpp:4:8: note: candidate expects 1 argument, 0 provided fldierase.cpp:4:8: note: candidate: ‘constexpr nod::nod(nod&&)’ fldierase.cpp:4:8: note: candidate expects 1 argument, 0 provided fldierase.cpp: At global scope: fldierase.cpp:76:5: error: redefinition of ‘int main()’ 76 | int main() | ^~~~ fldierase.cpp:41:5: note: ‘int main()’ previously defined here 41 | int main() | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FLdiErase face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.