anonymous
2009-03-24 08:31:00 UTC
#include "stdafx.h"
#include
#include
using namespace std;
int main()
{
double *testScores, // To dynamically allocate an array
total = 0.0, // Accumulator
average; // To hold average test score
int numTests, // to hold the number of tests entered
count; // Counter variable
// Get the number of tests to be entered.
cout << "How many tests do you wish to enter? ";
cin >> numTests;
// Dynamically allocate an array large enough to hold
// that many tests scores.
testScores = new double[numTests];
// Get the test scores.
cout << "Enter the test scores: " << endl;
for (count = 0; count < numTests; count++)
{
cout << "Test " << (count + 1) << ": ";
cin >> testScores[count];
}
if (testScores < 1)
{
cout << "Test scores must be greater than zero." << endl;
}