I have experience with scripting and linear programming, but I am having an issue with the code below and I hope someone can assist.
When executed, the programs runs as expected, unless a non-integer is used during cin >> a; - if a non-integer is used here, the code bypasses the cin >> b; and couts the INIT O and invokes the if(cin.fail()).
My question is: why does the program function in this manner?
Thanks - I know the program is faulty - I guess you could say I'm experimenting trying to find out how it works as I go. I didn't think the if statement would be called before it's time (so to speak) but I now understand it is a conditional whose parameters can be met anytime.
One thing about C++ is unlike other languages I've tried, there isn't a bunch of libraries loaded where the tutorial says "we'll worry about those later" - my brain can't' function that way - I need to know as I go. I can even look up the cin.clear and cin.sync above within this site's resources and learn.