I'm having an error on my displayResult function. In the line:
cout << setw(17) << static_cast<int>(exptRoll[value-1] * intRepeats);
I have a C2109 error (subscript requires array or pointer type. Does anyone how to solve this problem?
void displayResult(const int arraySize, double frequency[], double expected[], int intRepeats, double exptRoll)
{
cout << "\nGenerating rolls... \n " << endl; //message
cout << "\nFinal statistics: \n " << endl;
//Output the results of the dice rolling (sum, frequency, actual percent and expected rolls, expected percent)
cout << "" << endl; //begin the header
cout << "Point" << setw(17) << "Number of Rolls" << setw(17) << "Actual Percent"
<< setw(17) << "Expected Rolls" << setw(17) << "Expected Percent" << endl;
for (int value = 2; value < arraySize; value++) //begin generating the table
{
cout << setw(5) << value ; //value points
cout << setw(17) << static_cast<int>(frequency[value]) ; //actual rolls
cout << setw(16) << ((frequency[value]/intRepeats)*100) << "%" ; //actual percentage
cout << setw(17) << static_cast<int>(exptRoll[value-1] * intRepeats); //expected rolls
cout << setw(16) << setprecision (3) << expected[value]<< "%" << endl; //expected percentage
}
}