hi,
when casting a float to an int you lose the fractional part of the number . So does the code below round the float up to the next int in the most effective manner. If not could you please show how you would do it?
#include <iostream>
using namespace std;
int main ()
{
double num1 = 0;
int newnum = 0;
cout << endl << "Please Enter a float number and i Will round it up to the next whole number!"
<< endl;
cin >> num1;
newnum = num1 +1;
cout << newnum
<< endl;
return 0;
}