My assignment is to have an even integer greater than 2 entered and to output two odd prime numbers that add to it. We're supposed to use a bool function but I'm having trouble compiling. I'm getting an error that says "ambiguous overload for operator in cin >> variable"
No idea where I've gone wrong in my code. If you guys can offer any solutions, please make it as simple as possible. Beginner here!
#include <iostream>
using namespace std;
const int variable;
const int i = 1;
const int j = number - 1;
bool isPrime (int)
{
if ( variable > 2 && variable % 2 == 0 )
return true;
else
return false;
}
int main ()
{
cout << "Please enter an even integer greater than 2: " <<
cin >> variable;
If ( isPrime (variable) )
cout << "Two primes that add up to " << variable <<
" are " << i << " and " << j << endl;
Else
cout << "Invalid input!" << endl;
}
return 0;