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.
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.
Sounds like homework...
What is the problem? Show the code you have so far
Edit:
Haha, I just saw the other post
I really wanted to be mean now, but ill be nice. Good luck
Last edited by h3ro; 10-07-2007 at 01:49 PM.
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;
There is a few tutorials on loops here, you should check them out. It might be just the thing you need :O
i dont know what a loop is
Thats why you should read the tutorial...
just do it for me
Here you go. But I will only do this once,ok?just do it for me
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() % 6 + 1; dice2 = rand() % 6 + 1; dicesum = dice1 + dice2 cout << diesum; ) end noOfRolls(3) return 0; system("PAUSE"); return EXIT_SUCCESS; }
Thanks a lot but it does not run
Maybe you should read the tutorial then, to see why?
where is it
under the tutorial section i guess?
cant find it
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."
My best code is written with the delete key.