My issue is that my program dies whenever it attempts to readout the average and sum of the rolls. I think I need to include the size function in here somewhere but am not sure how to go about it. Possibly scrap the "do while" loop and go with something else, or just am completely missing something.
Here's the code:
using namespace std;
int sum5(int d1, int d2, int d3, int d4, int d5);
bool fiveOfAKind(int n1, int n2, int n3, int n4, int n5);
int i =0, sum=0, counter=0, avg=0;
int d1=0, d2=0, d3=0, d4=0, d5=0;
cout << "This program will calculate the number of 5 of a kind rolls." << endl;
DiceRoll.push_back(sum5(d1, d2, d3, d4, d5));
while(fiveOfAKind(d1, d2, d3, d4, d5)==false);
for (i=0; i<DiceRoll.size(); i++)
sum += DiceRoll[i];
cout << "The number of rolls it took to get five of a kind was " << counter << endl;
cout << "The average roll was " << avg << endl;
cout << "The sum of the rolls is " << sum << endl;
int sum5(int d1, int d2, int d3, int d4, int d5)
bool fiveOfAKind(int d1, int d2, int d3, int d4, int d5)
if (d1==d2 && d2==d3 && d3==d4 && d4==d5)
I promise I'm not that stupid, but I guess I am...
Luckily enough part of my program requirements had me implement the average and sum calculations inside the loop and I just never noticed the obvious division by zero, guess I should go home and rethink my life.