#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 | #64577449 | Utilizator | |
| Fișier | fldierase.cpp | Dimensiune | 1.12 KB |
| Data încărcării | 15 Mai 2026, 14:14 | Scor/rezultat | Eroare de compilare |
fldierase.cpp:18:8: error: redefinition of ‘struct nod’ 18 | struct nod | ^~~ fldierase.cpp:4:8: note: previous definition of ‘struct nod’ 4 | struct nod | ^~~ fldierase.cpp: In function ‘void creare(nod*&)’: fldierase.cpp:30:22: error: no matching function for call to ‘nod::nod()’ 30 | nod *nou=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:35:24: error: cannot convert ‘nod*’ to ‘int*’ in assignment 35 | prim=ultim=nou; | ^~~ | | | nod* fldierase.cpp:40:20: error: request for member ‘urm’ in ‘* ultim’, which is of non-class type ‘int’ 40 | ultim->urm=nou; | ^~~ fldierase.cpp:41:22: error: cannot convert ‘int*’ to ‘nod*’ in assignment 41 | nou->ant=ultim; | ^~~~~ | | | int* fldierase.cpp:42:19: error: cannot convert ‘nod*’ to ‘int*’ in assignment 42 | ultim=nou; | ^~~ | | | nod* fldierase.cpp: In function ‘int main()’: fldierase.cpp:75:12: error: invalid initialization of reference of type ‘nod*&’ from expression of type ‘int*’ 75 | creare(prim); | ^~~~ fldierase.cpp:24:19: note: in passing argument 1 of ‘void creare(nod*&)’ 24 | void creare(nod *&prim) | ~~~~~~^~~~ fldierase.cpp:76:10: error: cannot convert ‘int*’ to ‘nod*’ 76 | afis(prim); | ^~~~ | | | int* fldierase.cpp:47:16: note: initializing argument 1 of ‘void afis(nod*)’ 47 | void afis(nod *prim) | ~~~~~^~~~ fldierase.cpp:77:11: error: invalid initialization of reference of type ‘nod*&’ from expression of type ‘int*’ 77 | Erase(prim,ultim); | ^~~~ fldierase.cpp:58:18: note: in passing argument 1 of ‘void Erase(nod*&, nod*&)’ 58 | void Erase(nod *&prim, nod *&ultim){ | ~~~~~~^~~~ fldierase.cpp:78:10: error: cannot convert ‘int*’ to ‘nod*’ 78 | afis(prim); | ^~~~ | | | int* fldierase.cpp:47:16: note: initializing argument 1 of ‘void afis(nod*)’ 47 | void afis(nod *prim) | ~~~~~^~~~ fldierase.cpp: At global scope: fldierase.cpp:82:5: error: redefinition of ‘int main()’ 82 | int main() | ^~~~ fldierase.cpp:73:5: note: ‘int main()’ previously defined here 73 | 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ă.