1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <cmath>
int main() {
double x = 4.0;
double y = 3.0;
std::cout << "Square root of " << x << ": " << std::sqrt(x) << std::endl;
std::cout << x << " raised to power " << y << ": " << std::pow(x, y) << std::endl;
std::cout << "Absolute value of -5: " << std::abs(-5) << std::endl;
std::cout << "Ceiling of 3.7: " << std::ceil(3.7) << std::endl;
std::cout << "Floor of 3.7: " << std::floor(3.7) << std::endl;
return 0;
}
Back to cmath