#4165
Să se scrie o funcție C++ care inserează pe poziția k un nou nod cu informația x.
Problema de interviu
| Problema | FInserareKX | Operații I/O |
finserarekx.in/finserarekx.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #59952065 | Utilizator | |
| Fișier | finserarekx.cpp | Dimensiune | 806 B |
| Data încărcării | 14 Octombrie 2025, 09:46 | Scor/rezultat | Eroare de compilare |
finserarekx.cpp:13:8: error: redefinition of 'struct Nod' struct Nod ^ finserarekx.cpp:4:8: error: previous definition of 'struct Nod' struct Nod ^ finserarekx.cpp:17:4: error: invalid type in declaration before ',' token }*p, *u; ^ finserarekx.cpp: In function 'void FInserareKX(Nod*&, int, int)': finserarekx.cpp:25:25: warning: suggest parentheses around assignment used as truth value [-Wparentheses] } else if(head->leg=NULL){ ^ finserarekx.cpp: In function 'int main()': finserarekx.cpp:61:18: error: invalid initialization of reference of type 'Nod*&' from expression of type 'int*' FInserareKX(p,1,1); ^ finserarekx.cpp:18:6: error: in passing argument 1 of 'void FInserareKX(Nod*&, int, int)' void FInserareKX(Nod *&head, int k, int x){ ^ finserarekx.cpp:62:18: error: invalid initialization of reference of type 'Nod*&' from expression of type 'int*' FInserareKX(p,2,2); ^ finserarekx.cpp:18:6: error: in passing argument 1 of 'void FInserareKX(Nod*&, int, int)' void FInserareKX(Nod *&head, int k, int x){ ^ finserarekx.cpp:63:18: error: invalid initialization of reference of type 'Nod*&' from expression of type 'int*' FInserareKX(p,3,7); ^ finserarekx.cpp:18:6: error: in passing argument 1 of 'void FInserareKX(Nod*&, int, int)' void FInserareKX(Nod *&head, int k, int x){ ^ finserarekx.cpp:64:20: error: invalid initialization of reference of type 'Nod*&' from expression of type 'int*' FInserareKX(p,2,100); ^ finserarekx.cpp:18:6: error: in passing argument 1 of 'void FInserareKX(Nod*&, int, int)' void FInserareKX(Nod *&head, int k, int x){ ^ finserarekx.cpp:65:10: error: cannot convert 'int*' to 'Nod*' for argument '1' to 'void afisare(Nod*)' afisare(p); ^ finserarekx.cpp: In function 'int main()': finserarekx.cpp:69:5: error: redefinition of 'int main()' int main() ^ finserarekx.cpp:60:5: error: 'int main()' previously defined here int main(){ ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FInserareKX 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ă.