So I think I am done with the program and it's working fine, that's the code, if there are any comments please add them here.
Thank you,
-Amy
Code:
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
int iN, iM, x1, x2, n , N, M;
float counter = 0;
int sum;
n = 6;
N = 10;
M = 5;
for ( iM = 1; iM <= M; iM++ )
{
srand ( (unsigned) time (NULL) ); //Initialize RNG
for ( iN = 1; iN <= N; iN++ ) // Loop over the sequence
{
x1 = rand( ) % n + 1; // Generate a number from the sequence
cout<<x1<<" "; // Print it
x2 = rand( ) % n + 1; // Generate a number from the sequence
cout<<x2<<endl; // Print it
sum = x1 + x2;
if((sum==7) || (sum==11))
counter += 1;
}
cout<<endl;
}
cout<<"Average Probability: "<<(counter/M)/N;
cin.get();
return 0;
}