#include#include int main() { double num = std::sqrt(-1.0); if (std::isinf(num)) { std::cout << "The value is infinity" << std::endl; } else { std::cout << "The value is not infinity" << std::endl; } return 0; }
#includeThis code computes the value of 10 divided by 3, which is a finite number. The isinf function is then used to check if this value is infinite or not, and the output indicates that it is not. The std::isinf function is part of the C++ standard library and is included in the#include int main() { double num = 10.0 / 3.0; if (!std::isinf(num)) { std::cout << "The value is finite" << std::endl; } else { std::cout << "The value is not finite" << std::endl; } return 0; }