Stephan van Hulst wrote:First of all, start by making your program more clear by eliminating all the 'cases' you use. You can store your values in a simple array like this:
rolls[random -1]++;
This will *greatly* decrease the verbosity of your program, and make it more clear why it's doing what it does.
Stephan van Hulst wrote:I apologize, I didn't notice you already had a variable with that name. I meant a new variable, which you have interpreted correctly.
Anyway, looking at your program, I don't see why it would keep asking for input. You should have an entirely different problem on your hand, namely that you're stuck in a permanent loop. Have a look at the exit condition of your nested for loop.
By the way, you can also eliminate a lot in your display code.
If I may give you a big hint, I think you are using the nested loop for the wrong purpose. Tell me, how many dice do you have?
Stephan van Hulst wrote:It doesn't say in the requirements you need a nested loop.
[My Blog]
All roads lead to JavaRanch
Life is full of choices. Sometimes you make the good ones, and sometimes you have to kill all the witnesses.
Well THAT's new! Comfort me, reliable tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|