#896
FactorialF
C++
Să se scrie o funcție C++ care să returneze pentru un număr natural n
transmis ca parametru valoarea lui n!
, adică 1•2•...•n
.
Problema | FactorialF | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58059782 | Utilizator | |
Fișier | factorialf.cpp | Dimensiune | 2.07 KB |
Data încărcării | 12 Mai 2025, 09:49 | Scor / rezultat | Eroare de compilare |
factorialf.cpp: In function 'void ordo(nod*)': factorialf.cpp:41:29: warning: for increment expression has no effect [-Wunused-value] for(q=p->urm; q; q->urm) ^ factorialf.cpp: At global scope: factorialf.cpp:70:25: error: ISO C++ forbids declaration of 'ad_fata' with no type [-fpermissive] ad_fata(nod *prim, int x) ^ factorialf.cpp: In function 'int ad_fata(nod*, int)': factorialf.cpp:78:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ factorialf.cpp: At global scope: factorialf.cpp:79:27: error: expected identifier before '*' token void creatura(nod *&prim, *&ultim, int x) ^ factorialf.cpp: In function 'void creatura(nod*&, int*&, int)': factorialf.cpp:83:28: error: invalid initialization of reference of type 'nod*&' from expression of type 'int*' ad_sf(prim, ultim,x); ^ factorialf.cpp:14:6: error: in passing argument 2 of 'void ad_sf(nod*&, nod*&, int)' void ad_sf(nod *&prim1, nod *& ultim1, int x) ^ factorialf.cpp:88:26: error: request for member 'inf' in '* ultim', which is of non-class type 'int' else if(x>ultim->inf) ^ factorialf.cpp:89:33: error: invalid initialization of reference of type 'nod*&' from expression of type 'int*' ad_sf(prim, ultim, x); ^ factorialf.cpp:14:6: error: in passing argument 2 of 'void ad_sf(nod*&, nod*&, int)' void ad_sf(nod *&prim1, nod *& ultim1, int x) ^ factorialf.cpp: In function 'int main()': factorialf.cpp:126:5: error: redefinition of 'int main()' int main(){ ^ factorialf.cpp:109:5: error: 'int main()' previously defined here int main() ^ factorialf.cpp:129:17: error: 'fact' was not declared in this scope cout << fact(x) << endl; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema FactorialF 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ă.