when i want to input the value of equation,example is length and then i enter it a letter to the value,the program became error.Please help me to fix this program?Thank you!
when i want to input the value of equation,example is length and then i enter it a letter to the value,the program became error.
The C++ streams know you can't enter a character into a numeric value so if you try the stream will be put into an error state and no further processing can be done with that stream until you clear() the stream error and clean out the input buffer of all the incorrect values.
Something like:
1 2
cin.clear();
cin.ignore(2000,'\n');
And goto? Really? You need to learn to use some of the other control statements, and loops. The goto statement is really a bad idea in this program.
how to use this codes?please give me some examples.I'm new in here,i learn c++ just last week.So, i just know few structure.What kind of control statements do you mean jlb?Give me some example please.Can i replace goto statement with another statement that is work properly?
Did you try to use your favourite search engine and search for cin.clear() or cin.ignore()? There several good links within the first 5 links, most providing good examples.