for loop into while loop
likeray (0)

help, cannot turn for loop into a while loop.

for works well, just need to make an equivalent while

You are viewing a single comment. View All
mwilki7 (519)

@likeray

while (i < numOfRolls)
{
r=RandomInt(1, 6);
rollHist[r-1]++; // rollHist[r] value is incremented
totals+=r i++; // add the value or r to the totals
} // end of for loop

should be
while (i < numOfRolls)
{
r=RandomInt(1, 6);
rollHist[r-1]++; // rollHist[r] value is incremented
totals+=r; // add the value or r to the totals
i++;
} // end of for loop