how do i check a variable to make sure it is the correct data type?
i'm sure this question is answered somewhere on this board but i couldn't find it...
double number1;
cin >> number1;
if i enter a number the program runs fine.. but if by accident i type in 34D23KJ or something the program tries to put this into number1 then realizes it is not a valid double and crashes...
is there a function i can run to return true or false?!?!?
like number1.fail() or something... i'm a bit lost