#4685
Scrieți o funcție care va șterge dintr-o listă dublu înlănțuită primul nod care memorează valoarea A și ultimul nod care memorează valoarea B.
| Problema | LdiStergeAB | Operații I/O |
ldistergeab.in/ldistergeab.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64619080 | Utilizator | |
| Fișier | ldistergeab.cpp | Dimensiune | 733 B |
| Data încărcării | 18 Mai 2026, 22:05 | Scor/rezultat | Eroare de compilare |
ldistergeab.cpp: In function ‘void StergeAB(nod*&, nod*&, int, int)’: ldistergeab.cpp:17:15: error: invalid conversion from ‘nod*’ to ‘int’ [-fpermissive] 17 | nod p=prim,q=ultim; | ^~~~ | | | nod* ldistergeab.cpp:8:13: note: initializing argument 1 of ‘nod::nod(int)’ 8 | nod(int x) | ~~~~^ ldistergeab.cpp:17:22: error: invalid conversion from ‘nod*’ to ‘int’ [-fpermissive] 17 | nod p=prim,q=ultim; | ^~~~~ | | | nod* ldistergeab.cpp:8:13: note: initializing argument 1 of ‘nod::nod(int)’ 8 | nod(int x) | ~~~~^ ldistergeab.cpp:18:12: error: base operand of ‘->’ has non-pointer type ‘nod’ 18 | while(p->urm!=NULL) | ^~ ldistergeab.cpp:20:13: error: base operand of ‘->’ has non-pointer type ‘nod’ 20 | if(p->info==A){if(p->urm==NULL) ultim=p->ant; | ^~ ldistergeab.cpp:20:28: error: base operand of ‘->’ has non-pointer type ‘nod’ 20 | if(p->info==A){if(p->urm==NULL) ultim=p->ant; | ^~ ldistergeab.cpp:20:48: error: base operand of ‘->’ has non-pointer type ‘nod’ 20 | if(p->info==A){if(p->urm==NULL) ultim=p->ant; | ^~ ldistergeab.cpp:21:39: error: base operand of ‘->’ has non-pointer type ‘nod’ 21 | else p->ant->urm=p->urm; | ^~ ldistergeab.cpp:21:51: error: base operand of ‘->’ has non-pointer type ‘nod’ 21 | else p->ant->urm=p->urm; | ^~ ldistergeab.cpp:22:30: error: base operand of ‘->’ has non-pointer type ‘nod’ 22 | if(p->ant==NULL) prim=p->urm; | ^~ ldistergeab.cpp:22:49: error: base operand of ‘->’ has non-pointer type ‘nod’ 22 | if(p->ant==NULL) prim=p->urm; | ^~ ldistergeab.cpp:23:32: error: base operand of ‘->’ has non-pointer type ‘nod’ 23 | else p->urm->ant=p->ant; | ^~ ldistergeab.cpp:23:44: error: base operand of ‘->’ has non-pointer type ‘nod’ 23 | else p->urm->ant=p->ant; | ^~ ldistergeab.cpp:26:17: error: base operand of ‘->’ has non-pointer type ‘nod’ 26 | else p=p->urm; | ^~ ldistergeab.cpp:28:12: error: base operand of ‘->’ has non-pointer type ‘nod’ 28 | while(q->ant!=NULL) | ^~ ldistergeab.cpp:30:13: error: base operand of ‘->’ has non-pointer type ‘nod’ 30 | if(q->info==B){if(q->urm==NULL) ultim=q->ant; | ^~ ldistergeab.cpp:30:28: error: base operand of ‘->’ has non-pointer type ‘nod’ 30 | if(q->info==B){if(q->urm==NULL) ultim=q->ant; | ^~ ldistergeab.cpp:30:48: error: base operand of ‘->’ has non-pointer type ‘nod’ 30 | if(q->info==B){if(q->urm==NULL) ultim=q->ant; | ^~ ldistergeab.cpp:31:39: error: base operand of ‘->’ has non-pointer type ‘nod’ 31 | else q->ant->urm=q->next; | ^~ ldistergeab.cpp:31:51: error: base operand of ‘->’ has non-pointer type ‘nod’ 31 | else q->ant->urm=q->next; | ^~ ldistergeab.cpp:32:30: error: base operand of ‘->’ has non-pointer type ‘nod’ 32 | if(q->ant==NULL) prim=q->urm; | ^~ ldistergeab.cpp:32:49: error: base operand of ‘->’ has non-pointer type ‘nod’ 32 | if(q->ant==NULL) prim=q->urm; | ^~ ldistergeab.cpp:33:32: error: base operand of ‘->’ has non-pointer type ‘nod’ 33 | else q->urm->ant=q->ant; | ^~ ldistergeab.cpp:33:44: error: base operand of ‘->’ has non-pointer type ‘nod’ 33 | else q->urm->ant=q->ant; | ^~ ldistergeab.cpp:36:17: error: base operand of ‘->’ has non-pointer type ‘nod’ 36 | else q=q->ant; | ^~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema LdiStergeAB 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ă.