Horje
c++ round number down Code Example
c++ round number down
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	double num1 = 4.8;
  	double num2 = 4.3;
  	cout << floor(num1) << endl; // --> 4
  	cout << floor(num2) << endl; // --> 4
}
c++ round number up
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	double num1 = 4.8;
  	double num2 = 4.3;
  	cout << ceil(num1) << endl; // --> 5
  	cout << ceil(num2) << endl; // --> 5
}




Cpp

Related
arduino for command Code Example arduino for command Code Example
c++ how to loop through a vector but not the last element Code Example c++ how to loop through a vector but not the last element Code Example
how to print a string to console in c++ Code Example how to print a string to console in c++ Code Example
how to print list in c++ Code Example how to print list in c++ Code Example
cpp get data type Code Example cpp get data type Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8