#1168
FAdaugareLaLista
C++
Să se scrie o funcție C++ care adaugă o valoare la finalul unei liste simplu înlănțuite.
Problema | FAdaugareLaLista | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #42893297 | Utilizator | |
Fișier | fadaugarelalista.cpp | Dimensiune | 264 B |
Data încărcării | 21 Martie 2023, 17:03 | Scor / rezultat | Eroare de compilare |
fadaugarelalista.cpp: In function 'void adaugare(nod*&, int)': fadaugarelalista.cpp:12:7: error: no match for 'operator=' (operand types are 'nod' and 'nod*') q = new nod;//asa se aloca o zona de memorie ^ fadaugarelalista.cpp:12:7: note: candidates are: fadaugarelalista.cpp:4:8: note: nod& nod::operator=(const nod&) struct nod{ ^ fadaugarelalista.cpp:4:8: note: no known conversion for argument 1 from 'nod*' to 'const nod&' fadaugarelalista.cpp:4:8: note: nod& nod::operator=(nod&&) fadaugarelalista.cpp:4:8: note: no known conversion for argument 1 from 'nod*' to 'nod&&' fadaugarelalista.cpp:13:6: error: base operand of '->' has non-pointer type 'nod' q->info=x; ^ fadaugarelalista.cpp:14:6: error: base operand of '->' has non-pointer type 'nod' q->urm=NULL; ^ fadaugarelalista.cpp:16:10: error: cannot convert 'nod' to 'nod*' in assignment p=q; ^ fadaugarelalista.cpp:19:10: error: no match for 'operator=' (operand types are 'nod' and 'nod*') u=p; ^ fadaugarelalista.cpp:19:10: note: candidates are: fadaugarelalista.cpp:4:8: note: nod& nod::operator=(const nod&) struct nod{ ^ fadaugarelalista.cpp:4:8: note: no known conversion for argument 1 from 'nod*' to 'const nod&' fadaugarelalista.cpp:4:8: note: nod& nod::operator=(nod&&) fadaugarelalista.cpp:4:8: note: no known conversion for argument 1 from 'nod*' to 'nod&&' fadaugarelalista.cpp:20:16: error: base operand of '->' has non-pointer type 'nod' while(u->urm) ^ fadaugarelalista.cpp:21:15: error: base operand of '->' has non-pointer type 'nod' u=u->urm; ^ fadaugarelalista.cpp:22:10: error: base operand of '->' has non-pointer type 'nod' u->urm=q; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FAdaugareLaLista 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ă.