Author | Message |
---|---|
michaelkou
Posts: 7
|
Posted 18:11 Apr 18, 2016 |
For the last part, how do you generate random cases? Like addition, subtraction or multiplication. Thank you. |
kknaur
Posts: 540
|
Posted 18:14 Apr 18, 2016 |
One way is to take what you did for cases 1-3 and put them in a case 4 where you randomly choose which option to do using a random number generator. There are easier ways which you might be able to think of which involve less code, but what I mentioned is the more obvious one. |
michaelkou
Posts: 7
|
Posted 19:53 Apr 18, 2016 |
I don't get it by putting case 1-3 into case 4. Does that mean i should put another switch statement inside case 4? Last edited by michaelkou at
19:53 Apr 18, 2016.
|
rcamach7
Posts: 31
|
Posted 12:37 Apr 19, 2016 |
No, i'm not sure if adding another switch statement is possible but if it were it'll probably complicate things a lot more. You'll need to have the 3 cases in the last case and to select a random one you'll need to use a extra number generator. |