#827
CifMaxParRec
C++
Să se scrie o funcție C++ recursivă care să returneze cea mai mare cifră pară a unui număr natural transmis ca parametru.
Problema | CifMaxParRec | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #16329186 | Utilizator | |
Fișier | cifmaxparrec.cpp | Dimensiune | 286 B |
Data încărcării | 12 Iulie 2019, 14:23 | Scor / rezultat | Eroare de compilare |
cifmaxparrec.cpp: In function 'int cifmaxpar(unsigned int&)': cifmaxparrec.cpp:16:27: error: invalid initialization of non-const reference of type 'unsigned int&' from an rvalue of type 'unsigned int' if(cifmaxpar(n/10)<cif) ^ cifmaxparrec.cpp:4:5: error: in passing argument 1 of 'int cifmaxpar(unsigned int&)' int cifmaxpar(unsigned &n) ^ cifmaxparrec.cpp:20:23: error: invalid initialization of non-const reference of type 'unsigned int&' from an rvalue of type 'unsigned int' cifmaxpar(n/10); ^ cifmaxparrec.cpp:4:5: error: in passing argument 1 of 'int cifmaxpar(unsigned int&)' int cifmaxpar(unsigned &n) ^ cifmaxparrec.cpp: In function 'int main()': cifmaxparrec.cpp:27:25: error: invalid initialization of reference of type 'unsigned int&' from expression of type 'int' int y = cifmaxpar(x); ^ cifmaxparrec.cpp:4:5: error: in passing argument 1 of 'int cifmaxpar(unsigned int&)' int cifmaxpar(unsigned &n) ^ cifmaxparrec.cpp: In function 'int cifmaxpar(unsigned int&)': cifmaxparrec.cpp:22:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CifMaxParRec 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ă.