I have declared a double without a value. Later on I give it the value of the solution of an equation. The equation might however not have a solution all the time, which would result in an empty variable. I need a way to check if the variable is empty or not so that my program knows if it should carry on or do something else. Any suggestions?
Variables always have a value, they cannot be empty.
For custom classes you can define a state in which they can be considered "empty" (such as a container having no elements), but types like double always have a value, even if you don't initialize them. In that case, their value in undefined.
Instead, you should have a bool variable that indicates whether there was a solution or not.