Okay, I'm writing a program which will allow the user to input double values into an array until the array is full or the user enters non-numeric input. I've tried using cin.fail() with a while loop, which works fine for invalid input like:
However, if the user enters something like:
The cin will read it in until a character is reached and then it has not failed. It only fails after the numbers. How do I get it to exit the loop when this happens, without storing the 123 of 123T into the array, etc.
Help is much appreciated.