+ 1
How to round off decimal to nearest whole number in c++?
I'm new to C++ In a problem, the expected output should be 67 but it gives 66 when input value is 3. (200/3=66) Would someone help me, please. Thank you.
5 ответов
+ 4
#include <iostream>
#include <cmath>
using namespace std;
int main() {
cout << ceil(200.0/3);
return 0;
}
+ 3
First, tell me, do you need to round the number to its nearest value or round a number up to its nearest whole value?
For example:
input:
45.3
what should be the expected output?
45
or
46?
If you want to round it to the nearest value,you can use the round function:
https://code.sololearn.com/ca20A16A0a0a
Otherwise, use ceil function .If you want to round a number up to its nearest whole value.
+ 1
Thank you very much all of you
0
File handling statement c++
An audit firm have employees and customers. Customers can create request for audit, view current audit
status and can view previous audit reports. Create a nested structure program for such firm that stores audit,
customers and employees’ information in file. Each audit is conducted by an employee and is initiated by a
customer.