Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- #include <stdlib.h>
- int RollO=0;
- int RollD=0;
- int OWin=0;
- int Dwin=0;
- int main ()
- {
- // seed with random time
- srand(time(NULL));
- for(int x=1; x<1000000;x++)
- {
- for(int y=0; y<9; y++)
- {
- int rand_num = rand() % 6 + 1;
- int RollO=RollO+rand_num;
- }
- for(int z=0; z<9; z++)
- {
- int rand_num = rand() % 6 + 1;
- int RollD=RollD+rand_num;
- }
- If(RollD>RollO)
- DWin=Dwin+1;
- Else
- OWin=OWin+1;
- }
- cout << "Offense Wins: " << OWin << endl;
- cout << "Defense Wins: " << DWin << endl;
- cin.get();
- return 0;
- }
Add Comment
Please, Sign In to add comment