#2563
FAdCresc
C++
Să se scrie o funcție C++ care inserează într-o listă simplu înlănțuită cu elementele ordonate crescător un nou nod care memorează valoarea x
astfel încât informațiile din lista să fie în continuare ordonate crescător.
Problema | FAdCresc | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #50427624 | Utilizator | |
Fișier | fadcresc.cpp | Dimensiune | 510 B |
Data încărcării | 09 Aprilie 2024, 10:48 | Scor / rezultat | Eroare de compilare |
fadcresc.cpp: In function 'void ins_cresc(nod*&, int)': fadcresc.cpp:18:14: error: no match for 'operator=' (operand types are 'nod' and 'nod*') q=new nod; ^ fadcresc.cpp:18:14: note: candidates are: fadcresc.cpp:4:8: note: nod& nod::operator=(const nod&) struct nod{ ^ fadcresc.cpp:4:8: note: no known conversion for argument 1 from 'nod*' to 'const nod&' fadcresc.cpp:4:8: note: nod& nod::operator=(nod&&) fadcresc.cpp:4:8: note: no known conversion for argument 1 from 'nod*' to 'nod&&' fadcresc.cpp:19:14: error: base operand of '->' has non-pointer type 'nod' q->info=x; ^ fadcresc.cpp:20:14: error: base operand of '->' has non-pointer type 'nod' q->urm=p; ^ fadcresc.cpp:21:14: error: cannot convert 'nod' to 'nod*' in assignment p=q; ^ fadcresc.cpp:24:14: error: no match for 'operator=' (operand types are 'nod' and 'nod*') q=p; ^ fadcresc.cpp:24:14: note: candidates are: fadcresc.cpp:4:8: note: nod& nod::operator=(const nod&) struct nod{ ^ fadcresc.cpp:4:8: note: no known conversion for argument 1 from 'nod*' to 'const nod&' fadcresc.cpp:4:8: note: nod& nod::operator=(nod&&) fadcresc.cpp:4:8: note: no known conversion for argument 1 from 'nod*' to 'nod&&' fadcresc.cpp:25:20: error: base operand of '->' has non-pointer type 'nod' while(q->urm && q->urm->info<x) ^ fadcresc.cpp:25:30: error: base operand of '->' has non-pointer type 'nod' while(q->urm && q->urm->info<x) ^ fadcresc.cpp:26:20: error: base operand of '->' has non-pointer type 'nod' q=q->urm; ^ fadcresc.cpp:29:21: error: base operand of '->' has non-pointer type 'nod' r->urm=q->urm; ^ fadcresc.cpp:30:14: error: base operand of '->' has non-pointer type 'nod' q->urm=r; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FAdCresc 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ă.