// Ch. 15 Demo Program #1
// Mr. Minich
// Purpose - to illustrate the use of an apmatrix.
#include <iostream.h>
#include "M:\C++ Programming\AP classes\apmatrix.h"
int main()
{
int studentNum = 0; // student number loop variable
int testNum = 0; // test number loop variable
apmatrix <int> tests(6, 4, 0); // student test scores
int i = 0; // loop variable
for (studentNum = 1; studentNum <= 5; studentNum++)
{
for (testNum = 1; testNum <= 3; testNum++)
{
cout << "Enter the score for student #" << studentNum
<< ", Test #" << testNum << ": ";
cin >> tests[studentNum][testNum];
}
cout << endl; // inserting blank line between students
}
cout << "Enter a student number: ";
cin >> studentNum;
cout << "The test scores for student number " << studentNum << " are: ";
for (i = 1; i <= 3; i++)
{
cout << tests[studentNum][i] << " ";
}
cout << endl;
return 0;
}// end of main