Home › C++ Tutorial › C++ math
C++ math
cmath functions.
Include cmath for sqrt, pow, round, ceil, floor, abs. max and min need no header.
Example code
#include <iostream>
#include <cmath>
using namespace std;
int main() {
cout << sqrt(64) << " " << pow(2, 10) << " " << round(2.6) << " " << max(3, 8) << endl;
return 0;
}