Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <time.h>
- #include <stdlib.h>
- using namespace std;
- int main() {
- int num1, num2, suma;
- const int cotaSuperior=12;
- const int cotaInferior=2;
- vector<int> tiradas(cotaSuperior + 1);
- srand(time(NULL));
- for(int i=0; i<700;i++) {
- for (int j = 0; j < 10; j++) {
- num1 = rand() % (cotaSuperior / 2 - cotaInferior / 2 + 1) + cotaInferior / 2;
- num2 = rand() % (cotaSuperior / 2 - cotaInferior / 2 + 1) + cotaInferior / 2;
- suma = num1 + num2;
- cout << suma << '\n';
- tiradas[suma]++;
- }
- cout << '\n';
- }
- cout << "\n\n\n\n";
- for (int i = cotaInferior; i <= cotaSuperior; i++) {
- cout << "La cantidad de veces que la suma de los dados dio " << i << " es: " << tiradas[i] << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement