#include <iostream>
#include <cstdlib>
#include "runningSumAvg.h"
using namespace std;

/**
 * A program that has a bug. This bug may only show up in Strauss. Do
 * not fix the bug until you have determined exactly what it is and
 * can SHOW how it manifests. Then you may temporarily correct it to
 * validate your hypothesis.
 **/

int main(){

    int randomNumbers[10], runningSum[10];
    double runningAverage[10];

    for (int i = 0; i < 10; i++)
      {
        randomNumbers[i] = rand( ) % 101;
        cout << randomNumbers[i]  << "     ";
           }
    cout << endl;

    runningSum[0] = randomNumbers[0];
    for (int j = 0; j < 10; j++)
      {
        runningSum[j+1] = runningSum[j] + randomNumbers[j+1];
        cout << runningSum[j] << "     " ;
      }
    cout << endl;

    for (int k = 0; k < 10; k++)
      {
        runningAverage[k] = static_cast<double>(runningSum[k]) / ( k + 1 );
        cout << runningAverage[k] << "     ";
      }
    cout << endl;

    test(randomNumbers, runningSum, runningAverage, 10);

    return 0;
}

