Advertisement
informaticage

Dice roll

Mar 11th, 2021
859
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int diceRoll() {
  4.     return rand() % 6 + 1;
  5. }
  6.  
  7. int main (void) {
  8.     using namespace std;
  9.  
  10.     int mat[11][2] = {{0}};
  11.  
  12.     for(int i = 0; i < 100; i++) {
  13.         mat[diceRoll() + diceRoll()][0]++;
  14.     }
  15.  
  16.     for(int i = 0; i < 11; i++) {
  17.         cout << mat[i][0] << " ";
  18.     }
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement