#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 | #64808447 | Utilizator | |
| Fișier | fldierase.cpp | Dimensiune | 454 B |
| Data încărcării | 02 Iunie 2026, 17:42 | Scor/rezultat | Eroare de compilare |
fldierase.cpp: In function ‘void Erase(nod*&, nod*&)’: fldierase.cpp:29:13: error: expected ‘}’ before ‘else’ 29 | else { | ^~~~ fldierase.cpp:18:26: note: to match this ‘{’ 18 | if (p->info%2==0){ | ^ fldierase.cpp:30:9: error: ‘q’ was not declared in this scope 30 | q->urm->ant=q->ant; | ^ fldierase.cpp:31:17: error: type ‘<type error>’ argument given to ‘delete’, expected pointer 31 | delete q; | ^~~~~~~~ fldierase.cpp:33:17: error: ‘else’ without a previous ‘if’ 33 | else p=p->urm; | ^~~~ fldierase.cpp:36:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 36 | int main() | ^~ fldierase.cpp:36:9: note: remove parentheses to default-initialize a variable 36 | int main() | ^~ | -- fldierase.cpp:36:9: note: or replace parentheses with braces to value-initialize a variable fldierase.cpp:37:1: error: a function-definition is not allowed here before ‘{’ token 37 | { | ^ fldierase.cpp:75:2: error: expected ‘}’ at end of input 75 | } | ^ fldierase.cpp:15:36: note: to match this ‘{’ 15 | void Erase(nod *&prim, nod *&ultim){ | ^
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ă.