Thursday, 2 June 2022

Chapter 24 // Drill 4 - Principles & Practice Using C++

In this exercise I am using Visual Studio 2019 and a modified version of the std_lib_facilities header found here.

Chapter 24 // Drill 4

Write a program that takes ints from cin and outputs the sqrt() of each int, or "no square root" if sqrt(x) is illegal for some x (i.e., check your sqrt() return values).


So the std::sqrt function is explained here:

I didn't realise it returned floats, doubles or long doubles. It returns some error handles if something goes wrong defined here:


No comments:

Post a Comment