#1174
Să se scrie o funcție C++ care determină câte perechi de elemente prime între ele sunt memorate într-o lista simplu înlănțuită.
Problema | FListaNumarare2 | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57708113 | Utilizator | |
Fișier | flistanumarare2.cpp | Dimensiune | 486 B |
Data încărcării | 11 Aprilie 2025, 11:42 | Scor / rezultat | Eroare de compilare |
flistanumarare2.cpp:40:8: error: redefinition of 'struct nod' struct nod{ ^ flistanumarare2.cpp:4:8: error: previous definition of 'struct nod' struct nod{ ^ flistanumarare2.cpp:43:4: error: invalid type in declaration before ',' token }*p,*u; ^ flistanumarare2.cpp: In function 'void creare(int)': flistanumarare2.cpp:46:6: error: cannot convert 'nod*' to 'int*' in assignment p=new nod; ^ flistanumarare2.cpp:47:8: error: request for member 'inf' in '* p', which is of non-class type 'int' p->inf=x; ^ flistanumarare2.cpp:48:8: error: request for member 'adr' in '* p', which is of non-class type 'int' p->adr=NULL; ^ flistanumarare2.cpp:54:8: error: 'struct nod' has no member named 'inf' c->inf=x; ^ flistanumarare2.cpp:55:8: error: 'struct nod' has no member named 'adr' c->adr=NULL; ^ flistanumarare2.cpp:56:8: error: request for member 'adr' in '* u', which is of non-class type 'int' u->adr=c; ^ flistanumarare2.cpp:57:6: error: cannot convert 'nod*' to 'int*' in assignment u=c; ^ flistanumarare2.cpp: In function 'void afisare()': flistanumarare2.cpp:61:11: error: cannot convert 'int*' to 'nod*' in initialization for(nod*c=p;c!=NULL;c=c->adr) ^ flistanumarare2.cpp:61:26: error: 'struct nod' has no member named 'adr' for(nod*c=p;c!=NULL;c=c->adr) ^ flistanumarare2.cpp:62:14: error: 'struct nod' has no member named 'inf' cout<<c->inf<<' '; ^ flistanumarare2.cpp: In function 'int main()': flistanumarare2.cpp:66:2: error: 's' was not declared in this scope {s ^ flistanumarare2.cpp:67:5: error: expected ';' before 'int' int n; ^ flistanumarare2.cpp:68:16: error: 'n' was not declared in this scope while(fin>>n) ^ flistanumarare2.cpp: In function 'int main()': flistanumarare2.cpp:95:5: error: redefinition of 'int main()' int main() ^ flistanumarare2.cpp:65:5: error: 'int main()' previously defined here int main() ^ flistanumarare2.cpp:101:20: error: 'numarare' was not declared in this scope cout << numarare(p); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FListaNumarare2 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ă.