#1173
FListaNumarare1
C++
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 | #52042153 | Utilizator | |
Fișier | flistanumarare1.cpp | Dimensiune | 986 B |
Data încărcării | 17 Septembrie 2024, 12:10 | Scor / rezultat | Eroare de compilare |
flistanumarare1.cpp:43:8: error: redefinition of 'struct nod' struct nod{ ^ flistanumarare1.cpp:4:8: error: previous definition of 'struct nod' struct nod{ ^ flistanumarare1.cpp:46:5: error: invalid type in declaration before ',' token } *p, *u, *q, *t; ^ flistanumarare1.cpp: In function 'void Crearea(nod*&)': flistanumarare1.cpp:53:15: warning: NULL used in arithmetic [-Wpointer-arith] while (x!=NULL) ^ flistanumarare1.cpp:59:26: error: cannot convert 'nod*' to 'int*' in assignment u=p; ^ flistanumarare1.cpp:60:28: error: request for member 'urm' in '* u', which is of non-class type 'int' u->urm=NULL;} ^ flistanumarare1.cpp:61:16: error: cannot convert 'nod*' to 'int*' in assignment else {q=new nod; ^ flistanumarare1.cpp:62:20: error: request for member 'info' in '* q', which is of non-class type 'int' q->info=x; ^ flistanumarare1.cpp:63:20: error: request for member 'urm' in '* u', which is of non-class type 'int' u->urm=q; ^ flistanumarare1.cpp:65:20: error: request for member 'urm' in '* u', which is of non-class type 'int' u->urm=NULL;} ^ flistanumarare1.cpp: At global scope: flistanumarare1.cpp:72:15: error: ISO C++ forbids declaration of 'Afisare' with no type [-fpermissive] Afisare(nod*&p) ^ flistanumarare1.cpp: In function 'int Afisare(nod*&)': flistanumarare1.cpp:74:6: error: cannot convert 'nod*' to 'int*' in assignment q=p; ^ flistanumarare1.cpp:77:18: error: request for member 'info' in '* q', which is of non-class type 'int' cout<<q->info<<" "; ^ flistanumarare1.cpp:78:14: error: request for member 'urm' in '* q', which is of non-class type 'int' q=q->urm; ^ flistanumarare1.cpp:81:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ flistanumarare1.cpp: In function 'int numarare(nod*)': flistanumarare1.cpp:85:6: error: cannot convert 'nod*' to 'int*' in assignment t=p; ^ flistanumarare1.cpp:86:14: error: request for member 'urm' in '* t', which is of non-class type 'int' while(t->urm!=NULL) ^ flistanumarare1.cpp:88:15: error: request for member 'info' in '* t', which is of non-class type 'int' if(t->info==t->urm->info) ^ flistanumarare1.cpp:88:24: error: request for member 'urm' in '* t', which is of non-class type 'int' if(t->info==t->urm->info) ^ flistanumarare1.cpp:92:14: error: request for member 'urm' in '* t', which is of non-class type 'int' t=t->urm; ^ flistanumarare1.cpp: In function 'int main()': flistanumarare1.cpp:107:14: error: invalid initialization of reference of type 'nod*&' from expression of type 'int*' Crearea(p); ^ flistanumarare1.cpp:48:6: error: in passing argument 1 of 'void Crearea(nod*&)' void Crearea(nod * & p) ^ flistanumarare1.cpp:108:14: error: invalid initialization of reference of type 'nod*&' from expression of type 'int*' Afisare(p); ^ flistanumarare1.cpp:72:1: error: in passing argument 1 of 'int Afisare(nod*&)' Afisare(nod*&p) ^ flistanumarare1.cpp:109:21: error: cannot convert 'int*' to 'nod*' for argument '1' to 'int numarare(nod*)' cout<< numarare(p); ^ flistanumarare1.cpp:106:9: warning: unused variable 'n' [-Wunused-variable] int n; ^ flistanumarare1.cpp: In function 'int main()': flistanumarare1.cpp:143:5: error: redefinition of 'int main()' int main() ^ flistanumarare1.cpp:104:5: error: 'int main()' previously defined here int main() ^
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ă.