Timeline for First program: a simple calculator
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 30, 2016 at 5:07 | vote | accept | Francis Jasmin | ||
Apr 29, 2016 at 21:13 | comment | added | Denis | If you don't have any other question's don't forget to pick an answer to your question. | |
Apr 29, 2016 at 19:25 | comment | added | Denis | We are doing exactly this, however double.parse will assume that your input is 100 % okay to be converted into double and if it's actually not the program will try to put some string value in an int variable thus throwing an exception. The TryParse is what we need it returns a boolean result whether if the operations succeeded or not. If it succeeds it also saves the value to specified by you variable (out x). So if we want to check how's the operation going we need to use the second method. | |
Apr 29, 2016 at 18:29 | comment | added | Francis Jasmin | Hi Denis. When we check for correct user input. Why did you choose double.TryParse instead of double.Parse ? As i understand it, double.Parse can't be use with logic statement (like if and while). Well, why can't I tell the computer to use something like "While (we can't convert string to double (ak : !double.parse(string)))" do the following code. | |
Apr 20, 2016 at 18:07 | comment | added | Denis | Francis, if you have any questions feel free to ask me. | |
Apr 20, 2016 at 7:03 | comment | added | Denis | Correct we could have returned 'parse' and avoid converting | |
Apr 20, 2016 at 6:42 | comment | added | Heslacher |
if TryParse() succeeds why do you return double.Parse(tempInput); in the SetNumber() method ?
|
|
Apr 19, 2016 at 20:19 | comment | added | Francis Jasmin | Thx for the reply and help, I will read it with attention tonight, Cheers | |
Apr 19, 2016 at 19:54 | history | edited | Denis | CC BY-SA 3.0 |
added 134 characters in body
|
Apr 19, 2016 at 19:48 | history | answered | Denis | CC BY-SA 3.0 |