Guided Notes
Math & User Input
The cmath library, reading several values with cin, checking for bad input, and recovering with clear and ignore.
cmath essentials
Slide 1 / 5| Function | Result |
|---|---|
| std::sqrt(25.0) | 5 |
| std::pow(2, 10) | 1024 |
| std::abs(-4.5) | 4.5 |
| std::round(2.5) / std::floor(2.9) / std::ceil(2.1) | 3 / 2 / 3 |
| std::max(a, b) / std::min(a, b) | Larger / smaller (from <algorithm>) |
| std::hypot(3, 4) | 5 |
