|
From: Dany P. W. <da...@qu...> - 2003-05-02 04:51:01
|
Hi everyone, I've just reached the part about error handling and I'm afraid it had me thoroughly confuzzled! Here's a simple bit of code which, at the very end, requires a float input. How can I catch mistakes made by entering the wrong type of data, e.g. character where it should be numeric or visa versa? ==================================================== cin.ignore (1); cout << "\nName of Dish: "; getline (cin,sName); cout << "Description: "; getline (cin,sDescription); cout << "Price? "; cin >> fPrice; ==================================================== Any help would be immensely appreciated. I seem to learn better by simple examples. Cheers, D. -- This mail is a natural product. The slight variations in spelling and grammar enhance its individual character and beauty and in no way are to be considered flaws or defects. |