#4682
FLdiErase
C++
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 | #51406611 | Utilizator | |
Fișier | fldierase.cpp | Dimensiune | 1.49 KB |
Data încărcării | 13 Iunie 2024, 11:56 | Scor / rezultat | Eroare de compilare |
fldierase.cpp:19:8: error: redefinition of 'struct nod' struct nod ^ fldierase.cpp:4:8: error: previous definition of 'struct nod' struct nod ^ fldierase.cpp:23:7: error: invalid type in declaration before ',' token }*prim, *ultim, *c; ^ fldierase.cpp: In function 'void creare(nod*&, nod*&)': fldierase.cpp:70:13: error: no matching function for call to 'nod::nod()' c = new nod; ^ fldierase.cpp:70:13: 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:71:17: error: request for member 'info' in '* c', which is of non-class type 'int' cin >> c -> info; ^ fldierase.cpp:73:10: error: request for member 'ant' in '* c', which is of non-class type 'int' c -> ant = NULL; c -> urm = NULL; ^ fldierase.cpp:73:27: error: request for member 'urm' in '* c', which is of non-class type 'int' c -> ant = NULL; c -> urm = NULL; ^ fldierase.cpp:74:7: error: cannot convert 'int*' to 'nod*' in assignment p = c; u = c; ^ fldierase.cpp:74:14: error: cannot convert 'int*' to 'nod*' in assignment p = c; u = c; ^ fldierase.cpp:78:17: error: no matching function for call to 'nod::nod()' c = new nod; ^ fldierase.cpp:78:17: 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:79:21: error: request for member 'info' in '* c', which is of non-class type 'int' cin >> c -> info; ^ fldierase.cpp:80:14: error: request for member 'urm' in '* c', which is of non-class type 'int' c -> urm = NULL; ^ fldierase.cpp:81:14: error: request for member 'ant' in '* c', which is of non-class type 'int' c -> ant = u; ^ fldierase.cpp:82:18: error: cannot convert 'int*' to 'nod*' in assignment u -> urm = c; ^ fldierase.cpp:83:11: error: cannot convert 'int*' to 'nod*' in assignment u = c; ^ fldierase.cpp: In function 'int main()': fldierase.cpp:89:23: error: invalid initialization of reference of type 'nod*&' from expression of type 'int*' creare(prim, ultim); ^ fldierase.cpp:67:6: error: in passing argument 1 of 'void creare(nod*&, nod*&)' void creare(nod* &p, nod* &u){ ^ fldierase.cpp:90:22: error: invalid initialization of reference of type 'nod*&' from expression of type 'int*' Erase(prim, ultim); ^ fldierase.cpp:33:6: error: in passing argument 1 of 'void Erase(nod*&, nod*&)' void Erase(nod *&prim, nod *&ultim){ ^ fldierase.cpp:91:17: error: cannot convert 'int*' to 'nod*' for argument '1' to 'void afisare(nod*)' afisare(prim); ^ fldierase.cpp: In function 'int main()': fldierase.cpp:97:5: error: redefinition of 'int main()' int main() ^ fldierase.cpp:87: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ă.