0

I'm getting a parse error before '<' on line 26. What's going on that I don't seem to be seeing here?

#include <iostream>
using std::cin;
using std::cout;
using std::endl;


int main()
{

int num1, num2, num3, num4;
int avg;

cout << "Enter four numbers to be averaged." << endl;
cout << "\nNumbers must be between 0 and 100." << endl;

 while (cin >> num1 >> num2 >> num3 >> num4)
{
 try
    {
    avg = (num1 + num2 + num3 + num4)/4;
    cout << "The average is: " << avg << endl;
    }

    catch ( num1<0 & num2<0 & num3<0 & num4<0 )
      {
      cout << "Number(s) too low. " << endl;
      } 

      catch ( num1>100 & num2>100 & num3>100 & num4>100 )
      {
      cout << "Number(s) too high. " << endl;
      }

      cout << "Enter four numbers to be averaged." << endl;
      cout << "\nNumbers must be between 0 and 100." << endl;

}
     cout << endl;
 return 0;
}
3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by winbatch
0

How would I go about writing it so that it will catch if any of the four numbers are less than 0?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.