Dice Program Help

I'm having a problem adding up the values of the dice rolls in a while loop. The program will only store the last value so how would I get it to store multiples values? Here is my program thus far.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
        int die_1=0, die_2=0, total_score1, total_score2, player1score;
        char enter;

        cout<<"Welcome to the dice game. The rules are as follows: \n";
        cout<<"1. Roll the two dice and add up the total. \n";
        cout<<"2. If you roll a 7 or an 11, your turn is over and it is now the other players turn. \n";
        cout<<"3. If the other player rolls a 7 or an 11, then the scores are tallied and the player with the highest score wins.\n";
        cout<<"Enter the letter s and press enter to roll.\n";
        cin>>enter;
        srand(time(0));
        if((enter = 's') || (enter = 'S'))
        {
                do
                {
                        die_1 = (rand() % 6) +1;
                        die_2 = (rand() % 6) +1;
                        total_score1 = die_1 + die_2;
                        player1score = total_score1;
                        cout<<total_score1<<endl;
                }while((total_score1 != 7) && (total_score1 != 11));
                cout<<"Player score is: "<<player1score<<endl;
        }

        return 0;
}


Anyone know what operators or equation I should use to accomplish this?
Use an array or some standart container to hold multiple values
Topic archived. No new replies allowed.