int main()
{
double *monthSales = NULL; // a pointer used to point to an array holding monthly sales
double total = 0; // total of all sales
double average; // average of monthly sales
int numOfSales; // number of sales to be processed
int count; // loop counter
cout << fixed << showpoint << setprecision(2);
cout << "How many monthly sales will be processed? ";
cin >> numOfSales;
// Please write here the C++ statement for allocating the memory for an array of size numOfSales.
if ( monthSales == NULL )
{
cout << "Error allocating memory!\n";
return 1;
}
cout << "Enter the sales below\n";
for ( count = 0; count < numOfSales; count++)
{
cout << "Sales for Month number "
<< (count + 1) << ":";
// Please read the elements one by one using cin into the array monthSales
}
// Please write the code to calculate the total by summing up all elements of monthSales
average = total / numOfSales;
cout << "Average Monthly sale is $" << average << endl;
// Please deallocate the allocated memory for monthSales
return 0;
}
this program is incomplete program that calculates the total and the average amount of sales for a company. please help me to complete this program