#897
SumCifF
C++
Să se scrie o funcție C++ care să returneze suma cifrelor unui număr natural transmis ca parametru.
Problema | SumCifF | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #4208899 | Utilizator | |
Fișier | sumciff.cpp | Dimensiune | 154 B |
Data încărcării | 31 Ianuarie 2017, 20:54 | Scor / rezultat | Eroare de compilare |
sumciff.cpp: In function 'int sumcif(int, int)': sumciff.cpp:8:8: error: 'q' was not declared in this scope {int p=q ; ^ sumciff.cpp:10:3: error: 'm' was not declared in this scope {m=m*10 ; ^ sumciff.cpp:12:2: error: 'm' was not declared in this scope m=m+q ; ^ sumciff.cpp:13:2: error: 'retun' was not declared in this scope retun m ; ^ sumciff.cpp:13:8: error: expected ';' before 'm' retun m ; ^ sumciff.cpp:14:1: warning: no return statement in function returning non-void [-Wreturn-type] } ^ sumciff.cpp: In function 'int main()': sumciff.cpp:19:22: error: too few arguments to function 'int sumcif(int, int)' int y = sumcif(x); ^ sumciff.cpp:7:5: note: declared here int sumcif(int a, int b) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SumCifF 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ă.