In the program I'm writing, I begin it by getting two pieces of input (both are type "double") using cout and cin statements. If the first double is < 0 OR the second double is < 0 OR the second double is > 100, then an error message is printed. If not, then a series of if/else statements are executed based on the numbers the user input.
When I type in a random string of letters for the first double, the program automatically skips over the second input prompt and prints the error message. But when I type in a random string of letters for the second double, the program executes normally and assigns a value of 0 to the second double (which, if it is of any consequence, is what the next "else if" statement needs to execute. That is to say, the second double == 0).
My question is this: why will the program allow a string of random letters/numbers for the second double when it has been declared as a double? I'm not at liberty to show the code, but as I stated above, the program automatically jumps to the next "else if" statement as if the second double was == 0.
Not sure if this can be easily resolved without access to my code, but thanks for any attempts.
My question is this: why will the program allow a string of random letters/numbers for the second double
It is not. Your second double is unchanged and loop set to failure state, moreover failed inpud stays in input stream and will cause all future reads to double fail as well unless manually cleared (That is why it skips second variable input). If you did not set variable values before, they contains undefined values which can be anything.