0

Can someone see why my last event in Duct Tape challenge dosent want to be true?

Here is my code: https://code.sololearn.com/cK1Xpo1rFS4i/?ref=app

14th Aug 2022, 5:11 PM
eloufou
eloufou - avatar
4 Answers
0
Manually adding 0.5 is not guaranteed to round the number up, but you will always need to buy a full roll of duct tape even if a portion would be sufficient. You could use the standard ceil() function instead: #include <cmath> ... numberRollTSI = ceil(numberRollOS * 2);
14th Aug 2022, 11:53 PM
Shadow
Shadow - avatar
0
Shadow Worked! If you have the time, can you explain what this function does? I want to understand this function so I can use it on other code.
14th Aug 2022, 11:57 PM
eloufou
eloufou - avatar
0
It simply rounds a decimal number up to the nearest integer, e.g. ceil(0.1) = 1 ceil(0.5) = 1 ceil(1) = 1 ceil(-0.5) = 0 See: https://en.cppreference.com/w/cpp/numeric/math/ceil There are similar functions for rounding down, rounding to the closest integer, etc. in the standard library.
15th Aug 2022, 12:01 AM
Shadow
Shadow - avatar
0
Shadow Alright! I understand now. thank you so much for your help!
15th Aug 2022, 12:03 AM
eloufou
eloufou - avatar