//---------------------------------------------------------------------------- //----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 #include "smartintarrayclass.h" //---------------------------------------------------------------------------- int main(void) { smart_int_array StudentMarks; //----Note that this initializes the data int AMark; //----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 && StudentMarks.AddItem(AMark)) { cout << "Please enter the next mark (-1 to exit) : "; cin >> AMark; } //----Output the total and average cout << StudentMarks.NumberOfItems() << " marks were entered." << endl; cout << "The total mark is " << StudentMarks.Total() << " and the average is " << StudentMarks.Average() << endl; //----End program return(0); } //----------------------------------------------------------------------------