#4164
FAdaugaInainte
C++
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 | #50628319 | Utilizator | |
Fișier | fadaugainainte.cpp | Dimensiune | 664 B |
Data încărcării | 17 Aprilie 2024, 18:01 | Scor / rezultat | Eroare de compilare |
fadaugainainte.cpp: In function 'void FAdaugaInainte(Nod*&)': fadaugainainte.cpp:19:31: error: 'struct Nod' has no member named 'urm' while (p != nullptr && p->urm != nullptr) ^ fadaugainainte.cpp:21:16: error: 'struct Nod' has no member named 'urm' if (p->urm->inf % 2 != 0) ^ fadaugainainte.cpp:23:24: error: 'struct Nod' has no member named 'inf' int x = p->inf * 2; ^ fadaugainainte.cpp:24:13: error: 'nod' was not declared in this scope nod *q = new Nod{x, nullptr}; // Creăm un nou nod cu informația dublă ^ fadaugainainte.cpp:24:18: error: 'q' was not declared in this scope nod *q = new Nod{x, nullptr}; // Creăm un nou nod cu informația dublă ^ fadaugainainte.cpp:24:40: error: no matching function for call to 'Nod::Nod(<brace-enclosed initializer list>)' nod *q = new Nod{x, nullptr}; // Creăm un nou nod cu informația dublă ^ fadaugainainte.cpp:24:40: note: candidates are: fadaugainainte.cpp:8:5: note: Nod::Nod() Nod() ^ fadaugainainte.cpp:8:5: note: candidate expects 0 arguments, 2 provided fadaugainainte.cpp:4:8: note: constexpr Nod::Nod(const Nod&) struct Nod ^ fadaugainainte.cpp:4:8: note: candidate expects 1 argument, 2 provided fadaugainainte.cpp:4:8: note: constexpr Nod::Nod(Nod&&) fadaugainainte.cpp:4:8: note: candidate expects 1 argument, 2 provided fadaugainainte.cpp:26:25: error: 'struct Nod' has no member named 'urm' q->urm = p->urm; // Legăm noul nod la următorul nod al lui p ^ fadaugainainte.cpp:27:16: error: 'struct Nod' has no member named 'urm' p->urm = q; // Legăm nodul p la noul nod creat ^ fadaugainainte.cpp:30:20: error: 'struct Nod' has no member named 'urm' p = p->urm; ^ fadaugainainte.cpp:35:20: error: 'struct Nod' has no member named 'urm' p = p->urm; ^
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ă.