I've got this exercise from a book that wants me to program two rolling dice, add the value of the dice to together and basically track each time a number is rolled. So ive got an array with 11 spots for the numbers 2 - 12. Whats not working in my code is when i want it to add another roll to 9. The dice are rolled 36000 times, so no value should be above 36000. But they are either around 1226503 or sometimes -1075346436.
int a[10];
if (sum == 2) {
a[0] += 1;
}
if (sum == 3) {
a[1] += 1;
}
//This continues all the way to a[10], sum == 12
i've printed each sum that the dice are rolling, and that part of the code is fine so i didnt post it.