C++ program random number generator need help

Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last
• 10-07-2007
catdieselpow
C++ program random number generator need help
I need a program that can simulate two dice rolling and then add the sum up together. You enter how many times you roll the dice and then it displays how many times your combined roll is a 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12.
• 10-07-2007
h3ro
Sounds like homework...

What is the problem? Show the code you have so far

Edit:
Haha, I just saw the other post :D
I really wanted to be mean now, but ill be nice. Good luck :)
• 10-07-2007
catdieselpow
using namespace std;

int main(int argc, char *argv[])
{int dice1;
int dice2;
int dicesum;

dice1 = rand() % 6 + 1;
dice2 = rand() % 6 + 1;
dicesum = dice1 + dice2
cout << diesum;

return 0;
system("PAUSE");
return EXIT_SUCCESS;
• 10-07-2007
h3ro
There is a few tutorials on loops here, you should check them out. It might be just the thing you need :O
• 10-07-2007
catdieselpow
i dont know what a loop is
• 10-07-2007
h3ro
Thats why you should read the tutorial...
• 10-07-2007
catdieselpow
just do it for me
• 10-07-2007
h3ro
Quote:

just do it for me
Here you go. But I will only do this once,ok?

Code:

```using namespace std; int main(int argc, char *argv[]) { int dice1; int dice2; loop noOfRolls = 3; // Will make it do it 3 times int dicesum; do noOfRolls(3) ( dice1 = rand() &#37; 6 + 1; dice2 = rand() % 6 + 1; dicesum = dice1 + dice2 cout << diesum; ) end noOfRolls(3) return 0; system("PAUSE"); return EXIT_SUCCESS; }```
• 10-07-2007
catdieselpow
Thanks a lot but it does not run
• 10-07-2007
h3ro
Maybe you should read the tutorial then, to see why?
• 10-07-2007
catdieselpow
where is it
• 10-07-2007
h3ro
under the tutorial section i guess?
• 10-07-2007
catdieselpow
cant find it
• 10-07-2007
h3ro
• 10-07-2007
Prelude
Wow catdieselpow, are you completely helpless? Your entire thread reeks of "I don't want to work, I don't want to think, you do everything for me."
Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last