Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "TestScores.h"
- using namespace std;
- int main()
- {
- double scores1[] = { 47, 92, 56, 73, 65 },
- scores2[] = { 17, -3, 89, 84, 27 },
- scores3[] = { 63, 88, 102, 74, 39 };
- try
- {
- TestScores t1(scores1, 5);
- cout << "Average score: " << t1.returnAverage() << endl;
- }
- catch (double errorNum)
- {
- cout << "Error: " << errorNum << " is an invalid number" << endl;
- }
- try
- {
- TestScores t2(scores2, 5);
- cout << "Average score: " << t2.returnAverage() << endl;
- }
- catch (double errorNum)
- {
- cout << "Error: " << errorNum << " is an invalid number" << endl;
- }
- try
- {
- TestScores t3(scores3, 5);
- cout << "Average score: " << t3.returnAverage() << endl;
- }
- catch (double errorNum)
- {
- cout << "Error: " << errorNum << " is an invalid number" << endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment