I've 10 numbers to be read. My task is to generate exceptions with the numbers are either a negative number or a even number. Below is the code I wrote, but it isn't working.
using namespace std;
if(a[i]<0 && a%2==0)
cout<<"You ve entered a -ve number or a even number";
In function 'int main()': 16:24: error: invalid operands of types 'int ' and 'int' to binary 'operator%'
awith an integer
2. You should dereference it to get the value:
a[i] % 2 == 0.