#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 | #64752028 | Utilizator | |
| Fișier | flsimakelist.cpp | Dimensiune | 241 B |
| Data încărcării | 27 Mai 2026, 20:04 | Scor/rezultat | Eroare de compilare |
flsimakelist.cpp: In function ‘void MakeList(nod*&, int*, int)’: flsimakelist.cpp:17:13: error: conversion from ‘nod*’ to non-scalar type ‘nod’ requested 17 | nod r = head; | ^~~~ flsimakelist.cpp:20:10: error: base operand of ‘->’ has non-pointer type ‘nod’ 20 | r->info = a[i]; | ^~ flsimakelist.cpp:22:10: error: base operand of ‘->’ has non-pointer type ‘nod’ 22 | r->next = p; | ^~ flsimakelist.cpp:23:13: error: no match for ‘operator=’ (operand types are ‘nod’ and ‘nod*’) 23 | r = p; | ^ flsimakelist.cpp:4:8: note: candidate: ‘nod& nod::operator=(const nod&)’ 4 | struct nod | ^~~ flsimakelist.cpp:4:8: note: no known conversion for argument 1 from ‘nod*’ to ‘const nod&’ flsimakelist.cpp:4:8: note: candidate: ‘nod& nod::operator=(nod&&)’ flsimakelist.cpp:4:8: note: no known conversion for argument 1 from ‘nod*’ to ‘nod&&’ flsimakelist.cpp:25:6: error: base operand of ‘->’ has non-pointer type ‘nod’ 25 | r->next = NULL; | ^~ flsimakelist.cpp:16:9: warning: unused variable ‘i’ [-Wunused-variable] 16 | int i = 0; | ^
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ă.