//----------------------------------------------------------------------------
//----Write a program that stores the integer marks of a student for several
//----items of assessment, each of equal value. The program outputs the
//----total and average mark.
//----------------------------------------------------------------------------
#include <iostream.h>
#include "smartintarraylib.h"
//----------------------------------------------------------------------------
int main(void) {

smart_integer_array StudentMarks;
int AMark;

//----Initialize the data
Initialize(StudentMarks);

//----Prompt for assessment marks
cout << "Please enter the next mark (-1 to exit) : ";
cin >> AMark;
//----Loop until -1 is the mark or array is full
while (AMark >= 0 && AddItem(StudentMarks,AMark)) {
    cout << "Please enter the next mark (-1 to exit) : ";
    cin >> AMark;
    }

//----Output the total and average
cout << NumberOfItems(StudentMarks) << " marks were entered." << endl;
cout << "The total mark is " << Total(StudentMarks)
     << " and the average is " << Average(StudentMarks) << endl;

//----End program
return(0);
}
//----------------------------------------------------------------------------
