display an array of user input

//This program is suppose to take users sale amount for each month of the year //and display the sales and average.
//This program is only getting one error when I try to compile it, I don't know
//how to fix this
#include "stdafx.h"
#include<iostream>
#include<conio.h>
using namespace std;

int main()
{
int sub;
double average = 0;
double total = 0;
const int NumMonth = 12;
double MonthlySales[NumMonth];
for(sub = 0; sub < NumMonth; ++sub)
{
cout << "Enter Sales for month #" (sub + 1) << endl;
cin >> MonthlySales[sub];
}

cout << "The sales are: " << endl;
for(sub = 0; sub < NumMonth; ++sub)
{
total += MonthlySales[sub];
cout << MonthlySales[sub] << " ";
}
cout << endl;
average = total / NumMonth;
cout << "The average monthly sale is " << average << endl;
_getch();
return 0;
}
Topic archived. No new replies allowed.