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; }

25th Apr 2021, 6:18 PM
Benjamin Rios
Benjamin Rios - avatar
6 Answers
25th Apr 2021, 6:45 PM
Atul [Inactive]
+ 1
Got it! Thank you!!
25th Apr 2021, 6:46 PM
Benjamin Rios
Benjamin Rios - avatar
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."
25th Apr 2021, 6:39 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
you need to round to the nearest integer
25th Apr 2021, 6:40 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
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.
25th Apr 2021, 6:44 PM
Benjamin Rios
Benjamin Rios - avatar
0
cout << (int)ceil(total);
25th Apr 2021, 6:45 PM
Atul [Inactive]