-
123a problem again
Phillip raise a very good problem, I think. One operation have to be either totally fail or totally success.
In the 123a problem we read part of the input line and think we already read everything from the line. When an error occurs we got confussed like tegwin and try to debug :).
From Phillip 123a problem I got one rule for myself "An operation have to be either totally fail or totally success." That could save us a lot of bug.
Apply to the user input case. I remember in the old day when we have no stream at all, we had to read the input into an buffer and extract data from there(the buffer). That's ensure the input is totally read. In case of error, we can seek back our buffer and see what's wrong, and make decission either to discard or accept the input.
That's just some note. Hopefully it's also worth for your guys.
-
Concerning your checking algorithm : it is a little
more difficult than that.
For example : -1.0e+20 is a valid double.
Also, what if the user types in : 1.033.334..3 ?
-
true dat'
i have no clue how to get around the first double number u posted.. most likely the user won't try and input that and expect it to work... for the decimal problem.. i'm thinkin' about using the find&find_last_of functions...or something like that... and search for a decimal place... if find & find_last_of return a different position then then i know there is more than one decimal and i can return error.... i have fixed everything else and it is all finnally working... thnx for all the help.. hopefully if all goes well this is my last post in this thread
-
wow.. i finnally finished.. thnx for the help everyone..
program works perfectly.... I am one happy person..... :D
-
Can we have some beer tegwin ? :)