#1173
Să se scrie o funcție C++ care determină câte perechi de elemente consecutive egale sunt memorate într-o lista simplu înlănțuită.
| Problema | FListaNumarare1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64556743 | Utilizator | |
| Fișier | flistanumarare1.cpp | Dimensiune | 548 B |
| Data încărcării | 14 Mai 2026, 10:18 | Scor/rezultat | Eroare de compilare |
flistanumarare1.cpp:40:8: error: redefinition of ‘struct nod’ 40 | struct nod{ | ^~~ flistanumarare1.cpp:4:8: note: previous definition of ‘struct nod’ 4 | struct nod{ | ^~~ flistanumarare1.cpp:44:19: error: expected identifier before ‘*’ token 44 | int numarare(nod, *p){ | ^ flistanumarare1.cpp: In function ‘int numarare(nod, int*)’: flistanumarare1.cpp:48:14: error: request for member ‘urm’ in ‘* p’, which is of non-class type ‘int’ 48 | p=p->urm; | ^~~ flistanumarare1.cpp: In function ‘int main()’: flistanumarare1.cpp:59:11: error: cannot convert ‘nod*’ to ‘int*’ in assignment 59 | p=new nod; | ^~~~~~~ | | | nod* flistanumarare1.cpp:60:17: error: request for member ‘inf’ in ‘* p’, which is of non-class type ‘int’ 60 | cin>>p->inf; | ^~~ flistanumarare1.cpp:64:17: error: request for member ‘urm’ in ‘* ul’, which is of non-class type ‘int’ 64 | ul->urm=p; | ^~~ flistanumarare1.cpp:67:9: error: request for member ‘urm’ in ‘* ul’, which is of non-class type ‘int’ 67 | ul->urm=NULL; | ^~~ flistanumarare1.cpp:68:20: error: could not convert ‘prim’ from ‘int*’ to ‘nod’ 68 | cout<<numarare(prim); | ^~~~ | | | int* flistanumarare1.cpp: At global scope: flistanumarare1.cpp:95:5: error: redefinition of ‘int main()’ 95 | int main() | ^~~~ flistanumarare1.cpp:52:5: note: ‘int main()’ previously defined here 52 | int main() | ^~~~ flistanumarare1.cpp: In function ‘int main()’: flistanumarare1.cpp:101:26: error: could not convert ‘p’ from ‘nod*’ to ‘nod’ 101 | cout << numarare(p); | ^ | | | nod*
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FListaNumarare1 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ă.