For Uni I have been asked to make a Yahtzee game in C++ following some instruction...all was going well up to a point where I have been asked to iterate a loop 13 times (one for each of the possible dice rolls combos in Yahtzee)
Here is my current source code: There may be other issues I am not aware of within this code - there are also the sections blocked/commented out with a '//' or a '*/ /*' arrangement.
I specifically need assistance with '//Hold and/or Re-Roll', '//iterate loop 13 times' and '//check for bonus'
int sum = 0;
int num = 5;
int roll[5] = {0};
int count[6] = {0};
int score[13] = {0};
int h = 1;
int r = 0;
int holdorroll, holdorroll2, holdorroll3, holdorroll4, holdorroll5;
/*
cout << "Please enter 5 numbers" << endl;
for (int i = 0; i < 5; i++)
cin >> roll [i];
for (int i = 0; i < 5; i++)
sum += roll[i];
*/
//Hold and/or Re-Roll
cout << " " << endl;
cout << "To select which die to hold and which to re-roll, key in 'h' for hold and 'r' for re-roll int ths same order they appear on your screen. To continue key return. " << endl; // Enter in the hold/re-roll commands ...
Would you first modify your post and put [code]code tags[/code] around your code so we can clearly see the syntax highlighting?
As for the 13 times, think of all the possible dice rolls, maybe store them in an array or two (or better yet find a pattern) and then iterate with a loop of your choice, such as the for loop.