Hi there. I need help with my program. Basically it has to collect dice rolling statistics using functions. the output i'm getting from my code does not count anything. Please help. Thanks
You only need to seed the random function once at the beginning of the program, so you can move the srand line out of the function and to the beginning of main.
diceTotal is an integer, so you want to check for 1,2,3.. etc. instead of '1','2','3' etc.
The rolling of the dice is outside the while loop, so right now you're only doing one roll of the dice.
i is initialized to 0, so if a user enters 5, you actually end up looping through the while loop 6 times.
I might suggest using an array or vector instead of having separate variables for each roll type.
Edit:
You could also use a for loop since you know how many times you need to roll the dice. Let's say you had an array rollCounter with 11 elements.
for (as many times as the user wants to roll the dice)
--- diceTotal = result of roll function
--- rollCounter[diceTotal-1] increments by 1
hi wildblue & Jakee, Thank you so much for the help. I followed your comments mentioned above and was actually able to fix my code and got my program working. I can't use array because my class prof has not taught us anything about it yet. But regardless, I got my program working. Thanks alot! :)