Hi all and thanks in advance for any help.
I have a basic program that needs to read a number of inputs from a user.
To all these inputs I assign a default value before I call for the user to give diffrent input.
Here is the thing, the input is of type double. I use the folloing code for example:
double a=17.5;
double b=10;
double c=9;
std::cout<<"enter a Real value for a:"<<std::endl;
std::cin>>a;
std::cout<<"endt a Real value for b:<<std::endl;
std::cin<<b;
ect'
If the user enters a char such as 'e', then the value of 'a' doesn't change, however, the programe ignores all the other std::cin, but it does print out all the output... hence the user doens't get a chance to input the rest of the data because of his first mistake.
How do I prevent this from happening?
Cheers for the help.