#4683
Să se scrie o funcție ce va crea o listă simplu înlănțuită care să memoreze în nodurile sale cele n numere întregi din vector, în ordinea în care se află în a. Pointerul head va memora în final adresa primului nod din listă.
| Problema | FLsiMakeList | Operații I/O |
flsimakelist.in/flsimakelist.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64761456 | Utilizator | |
| Fișier | flsimakelist.cpp | Dimensiune | 483 B |
| Data încărcării | 28 Mai 2026, 12:39 | Scor/rezultat | Eroare de compilare |
flsimakelist.cpp:17:8: error: redefinition of ‘struct nod’ 17 | struct nod{ | ^~~ flsimakelist.cpp:4:8: note: previous definition of ‘struct nod’ 4 | struct nod | ^~~ flsimakelist.cpp: In function ‘void AdaugareSfarsit(int)’: flsimakelist.cpp:26:10: error: ‘struct nod’ has no member named ‘next’ 26 | nou->next=NULL; | ^~~~ flsimakelist.cpp:29:11: error: cannot convert ‘nod*’ to ‘int*’ in assignment 29 | p=nou; | ^~~ | | | nod* flsimakelist.cpp:31:13: error: request for member ‘next’ in ‘* u’, which is of non-class type ‘int’ 31 | else u->next=nou; | ^~~~ flsimakelist.cpp:33:7: error: cannot convert ‘nod*’ to ‘int*’ in assignment 33 | u=nou; | ^~~ | | | nod* flsimakelist.cpp: In function ‘int main()’: flsimakelist.cpp:46:16: error: cannot convert ‘int*’ to ‘nod*’ in initialization 46 | for (nod*i=p;i;i=i->next) | ^ | | | int* flsimakelist.cpp:46:25: error: ‘struct nod’ has no member named ‘next’ 46 | for (nod*i=p;i;i=i->next) | ^~~~ flsimakelist.cpp: At global scope: flsimakelist.cpp:51:5: error: redefinition of ‘int main()’ 51 | int main() | ^~~~ flsimakelist.cpp:43:5: note: ‘int main()’ previously defined here 43 | int main() | ^~~~ flsimakelist.cpp: In function ‘int main()’: flsimakelist.cpp:56:5: error: ‘MakeList’ was not declared in this scope 56 | MakeList(h, a, n); | ^~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FLsiMakeList 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ă.