0
Paint Costs Exercise Help
Hi, I am trying to do the paint costs exercise in C++ and I am passing all the test cases except the last one. Can you please help to see the flaw in my code? My current code is: #include <iostream> #include <cmath> using namespace std; int main() { int paint; float tax; float total; cin >> paint; total = 40.00 + (paint * 5.00); tax = total * 0.1; total += tax; cout << ceil(total); return 0; }
6 ответов
+ 1
As Ярослав Вернигора(Yaroslav Vernigora) said you round off it or convert the ceil to int
+ 1
Got it! Thank you!!
0
Hi! most likely, you did not meet this condition:
"Output format
A number representing the value of your purchase, rounded to the nearest integer."
0
you need to round to the nearest integer
0
Isn't that what the ceil() function does? All the other test cases have rounded up, but I'm not sure why the last test case won't pass.
0
cout << (int)ceil(total);