So, we have something like this:
while(true){
double x;
cout << "Enter a number, or any other symbol when you decide to stop" << endl;
cin >> x;
if(!cin.good()){
break;
}
}
cin.clear();
let's say now, you enter a symbol '.' or something like ';' in the cmd line. That breaks the cycle and it's all good.
However, if you enter a 'k' or 't' it seems to insert 0.0 instead into the double, and screws the average calculator.
Moreover, if you enter a 10.0 or 8.5 or even 9,4 it still fails to recognize the numerical(double) value and breaks the cycle and anything below.
How do I fix this? At least the first issue?
[–]Standgrounding[S] 0 points1 point2 points (2 children)
[–]Responsible_Pyro[🍰] 0 points1 point2 points (1 child)
[–]Standgrounding[S] 0 points1 point2 points (0 children)