Game help

Hello everyone.

Would you guys help me figure out what I am doing wrong. I am trying to write a dice program that rolls 2 dice and as long as there isn't a 2 or a 5 rolled it adds the dice and outputs the sum. I have it rolling the dice but it is ignoring my stipulation of a roll of 2 or 5 outputs your score is zero. Eventually I would like to turn this into a stuck in the mud game with multiple players but I am just taking baby steps first, however I would welcome suggestions on this as well.

Thank you

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
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <ctime>
#include <stdlib.h>
//contains (among other things) functions that deal with generating random numbers.


using namespace std;
int rollDice();

int main()
{
		
//cout << "enter direction number of player";  
//char number_of_players;
//cin >> number_of_players;

srand((unsigned)time(0));
int sumOfDice = rollDice();
}
bool rolling = true;

int rollDice(){

int dice1 = 1 + rand()%6;
int dice2 = 1 + rand()%6;

int total = dice1 + dice2;

bool rolling = true;


if (dice1 || dice2 != 2 || 5  )
{
cout << "Player rolls " << dice1 << " and " << dice2 << " for a total of " << total << " You win!" << endl;}

else 
{
cout << "Player rolls " << dice1 << " and " << dice2 << "your score is zero.\n";}while (rolling = true);
	

system ("pause");

return total;}
Topic archived. No new replies allowed.