Ok, this is actually very simple I just can't figure it out... first of all I'm a complete beginner in C++ and I was given this assignment to do a dice game (yes assignment, please note that I'm not looking for a code, just help on how to do it). Here's a code for the dices:

srand(time(0));
dice1=rand() % 6 + 1;
dice2=rand() % 6 + 1;
cpudice1=rand() % 6 + 1;
cpudice2=rand() % 6 + 1;

There are 3 rounds then you win or lose, but here the thing: how do I loop this so that I can throw again? Also I need to do so that if someone wins 2 times in a row the 3rd round isn't played at all, I'm stuck, please help me understand loop, I know that there are three, while do-while and for, what should I use and how?

Again I must write that I do not want a complete code how to do this, I want some help understanding what I'm supposed to do, and yes I am aware that this is simple and I will seem like an idiot lol.

Thanks :)

Edited by Warcat: n/a

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by sfuo

Make a function that return a random int from 1-6;

then

player1 = randomDiceRoll();
player2 = randomeDiceRoll();
//and so on.

have a counter that counts points.
int playerPoints =0;
int compPoints = 0;

//use a while loop
while(true)
{
//roll dice
//check winner
``while(!done)``