#4164
Să se scrie o funcție C++ care inserează înainte de fiecare nod cu informația impară dublul său.
| Problema | FAdaugaInainte | Operații I/O |
fadaugainainte.in/fadaugainainte.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 0.2 MB
/
Stivă 0.2 MB
|
| Id soluție | #63926662 | Utilizator | |
| Fișier | fadaugainainte.cpp | Dimensiune | 339 B |
| Data încărcării | 27 Martie 2026, 08:44 | Scor/rezultat | Eroare de compilare |
fadaugainainte.cpp: In function 'void FAdaugaInainte(Nod*&)': fadaugainainte.cpp:19:3: error: 'nou' was not declared in this scope {nou=new Nod; ^ fadaugainainte.cpp:24:10: error: no match for 'operator=' (operand types are 'Nod' and 'Nod*') p=head;q=p->leg; ^ fadaugainainte.cpp:24:10: note: candidates are: fadaugainainte.cpp:4:8: note: Nod& Nod::operator=(const Nod&) struct Nod ^ fadaugainainte.cpp:4:8: note: no known conversion for argument 1 from 'Nod*' to 'const Nod&' fadaugainainte.cpp:4:8: note: Nod& Nod::operator=(Nod&&) fadaugainainte.cpp:4:8: note: no known conversion for argument 1 from 'Nod*' to 'Nod&&' fadaugainainte.cpp:26:6: error: base operand of '->' has non-pointer type 'Nod' if(q->info%2!=0) ^ fadaugainainte.cpp:27:3: error: 'nou' was not declared in this scope {nou=new Nod; ^ fadaugainainte.cpp:28:16: error: base operand of '->' has non-pointer type 'Nod' nou->info=2*q->info; ^ fadaugainainte.cpp:31:5: error: base operand of '->' has non-pointer type 'Nod' p=q->leg; ^ fadaugainainte.cpp:32:3: error: no match for 'operator=' (operand types are 'Nod' and 'Nod*') q=p->leg;} ^ fadaugainainte.cpp:32:3: note: candidates are: fadaugainainte.cpp:4:8: note: Nod& Nod::operator=(const Nod&) struct Nod ^ fadaugainainte.cpp:4:8: note: no known conversion for argument 1 from 'Nod*' to 'const Nod&' fadaugainainte.cpp:4:8: note: Nod& Nod::operator=(Nod&&) fadaugainainte.cpp:4:8: note: no known conversion for argument 1 from 'Nod*' to 'Nod&&' fadaugainainte.cpp:34:5: error: cannot convert 'Nod' to 'Nod*' in assignment {p=q; ^ fadaugainainte.cpp:35:7: error: base operand of '->' has non-pointer type 'Nod' q=q->leg;}} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FAdaugaInainte 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ă.