Does not make any sense why this code isn't working.
Here are my instructions: NOTE: in mathematics, the square root of a negative number is not real; in C++ therefore, passing such a value to the square root function is an error.
Given a double variable named areaOfSquare write the necessary code to read in a value, the area of some square, into areaOfSquare and print out the length of the side of that square.
HOWEVER: if any value read in is not valid input, just print the message "INVALID".
Here is my code. What am I doing wrong? Instead of getting 1.41 etc etc whatever square root of 2 is... it is taking 2 * 2 = 4 and square rooting that back to 2 for some reason! Why am I not getting the decimal? My double is declared and math library IS included. Any help would be great!
The OUTPUT I'm getting: User puts in 10 they get 10 back.
The OUTPUT I should be getting: User puts in 10 and they get 3.16228 back!
It's almost as if it isn't executing the sqroot statement, or it is but in a horribly wrong way.