#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 | #58291659 | Utilizator | |
Fișier | fldierase.cpp | Dimensiune | 1.99 KB |
Data încărcării | 25 Mai 2025, 14:03 | Scor / rezultat | Eroare de compilare |
fldierase.cpp:126:1: error: stray '\302' in program return 0; ^ fldierase.cpp:126:1: error: stray '\240' in program fldierase.cpp:126:1: error: stray '\302' in program fldierase.cpp:126:1: error: stray '\240' in program fldierase.cpp:126:1: error: stray '\302' in program fldierase.cpp:126:1: error: stray '\240' in program fldierase.cpp:126:1: error: stray '\302' in program fldierase.cpp:126:1: error: stray '\240' in program fldierase.cpp:126:1: error: stray '\302' in program fldierase.cpp:126:1: error: stray '\240' in program fldierase.cpp:17:8: error: redefinition of 'struct nod' struct nod ^ fldierase.cpp:4:8: error: previous definition of 'struct nod' struct nod ^ fldierase.cpp:21:8: error: invalid type in declaration before ',' token } *prim, *ultim, *p, *r, *q; ^ fldierase.cpp: In function 'void create()': fldierase.cpp:27:11: error: no matching function for call to 'nod::nod()' p=new nod; ^ fldierase.cpp:27:11: note: candidates are: fldierase.cpp:8:5: note: nod::nod(int) nod(int x) ^ fldierase.cpp:8:5: note: candidate expects 1 argument, 0 provided fldierase.cpp:4:8: note: constexpr nod::nod(const nod&) struct nod ^ fldierase.cpp:4:8: note: candidate expects 1 argument, 0 provided fldierase.cpp:4:8: note: constexpr nod::nod(nod&&) fldierase.cpp:4:8: note: candidate expects 1 argument, 0 provided fldierase.cpp:28:13: error: request for member 'info' in '* p', which is of non-class type 'int' cin>>p->info; ^ fldierase.cpp:29:8: error: request for member 'urm' in '* p', which is of non-class type 'int' p->urm=NULL; ^ fldierase.cpp:30:8: error: request for member 'ant' in '* p', which is of non-class type 'int' p->ant=NULL; ^ fldierase.cpp:35:15: error: no matching function for call to 'nod::nod()' p=new nod; ^ fldierase.cpp:35:15: note: candidates are: fldierase.cpp:8:5: note: nod::nod(int) nod(int x) ^ fldierase.cpp:8:5: note: candidate expects 1 argument, 0 provided fldierase.cpp:4:8: note: constexpr nod::nod(const nod&) struct nod ^ fldierase.cpp:4:8: note: candidate expects 1 argument, 0 provided fldierase.cpp:4:8: note: constexpr nod::nod(nod&&) fldierase.cpp:4:8: note: candidate expects 1 argument, 0 provided fldierase.cpp:36:17: error: request for member 'info' in '* p', which is of non-class type 'int' cin>>p->info; ^ fldierase.cpp:37:12: error: request for member 'urm' in '* p', which is of non-class type 'int' p->urm=NULL; ^ fldierase.cpp:38:12: error: request for member 'ant' in '* p', which is of non-class type 'int' p->ant=NULL; ^ fldierase.cpp:39:16: error: request for member 'urm' in '* ultim', which is of non-class type 'int' ultim->urm=p; ^ fldierase.cpp:40:12: error: request for member 'ant' in '* p', which is of non-class type 'int' p->ant=ultim; ^ fldierase.cpp: In function 'void parcurgere()': fldierase.cpp:49:18: error: request for member 'info' in '* p', which is of non-class type 'int' cout<<p->info<<" "; ^ fldierase.cpp:50:14: error: request for member 'urm' in '* p', which is of non-class type 'int' p=p->urm; ^ fldierase.cpp:56:18: error: request for member 'info' in '* p', which is of non-class type 'int' cout<<p->info<<" "; ^ fldierase.cpp:57:14: error: request for member 'ant' in '* p', which is of non-class type 'int' p=p->ant; ^ fldierase.cpp: In function 'int main()': fldierase.cpp:124:22: error: invalid initialization of reference of type 'nod*&' from expression of type 'int*' Erase(prim, ultim); ^ fldierase.cpp:61:6: error: in passing argument 1 of 'void Erase(nod*&, nod*&)' void Erase(nod *&prim, nod *&ultim) ^ fldierase.cpp: In function 'int main()': fldierase.cpp:131:5: error: redefinition of 'int main()' int main() ^ fldierase.cpp:120:5: error: 'int main()' previously defined here 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ă.