SilverhandX

testscoresmain.cpp

Mar 21st, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.83 KB | None | 0 0
  1. #include <iostream>
  2. #include "TestScores.h"
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     double scores1[] = { 47, 92, 56, 73, 65 },
  8.         scores2[] = { 17, -3, 89, 84, 27 },
  9.         scores3[] = { 63, 88, 102, 74, 39 };
  10.  
  11.     try
  12.     {
  13.         TestScores t1(scores1, 5);
  14.         cout << "Average score: " << t1.returnAverage() << endl;
  15.     }
  16.     catch (double errorNum)
  17.     {
  18.         cout << "Error: " << errorNum << " is an invalid number" << endl;
  19.     }
  20.  
  21.     try
  22.     {
  23.         TestScores t2(scores2, 5);
  24.         cout << "Average score: " << t2.returnAverage() << endl;
  25.     }
  26.     catch (double errorNum)
  27.     {
  28.         cout << "Error: " << errorNum << " is an invalid number" << endl;
  29.     }
  30.  
  31.     try
  32.     {
  33.         TestScores t3(scores3, 5);
  34.         cout << "Average score: " << t3.returnAverage() << endl;
  35.     }
  36.     catch (double errorNum)
  37.     {
  38.         cout << "Error: " << errorNum << " is an invalid number" << endl;
  39.     }
  40.  
  41.     return 0;
  42. }
Add Comment
Please, Sign In to add comment