You mention that you're new to programming. Have you just covered basic o/p (i.e. cout) and loops, etc so far??
To improve you code you could (in addition to fixing your maths like Peter87 says):
1. tidy it up a bit (you did say it's messy)
2. simplfy the last
if else
in both you if statements (if I understand correctly, the last test is for all remaining possible numbers?)
3. you could use a little helper function to make what's going on a bit more obvious?
1 2 3 4
|
int rollDie()
{
return (rand()%6)+1;
}
|
1 2 3 4 5 6 7 8
|
...
for(int game=1; game<4; game++)
{
dieOne=(rand()%6)+1;//creates dice
dieTwo=(rand()%6)+1;
....
|
4 Tighten up the scope of some of you variables. e.g. roll is only used inside the for loop.
5. And finally, are you allowed to carry on playing when you've run out of money?
Andy
PS I think Maxim's suggestion about the array is a bit borderline here. Might come in useeful later, though?