Error message

I am having a problem with one of my class excercises it is the last one I have to do. I get the message c2440 '?':cannot convert from 'overloaded-function'to 'bool'. My instructor demonstrated last night but he went too fast and I couldn't keep up with what he did. He is not using pointers yet so please do not suggest it. Any help would be welcome. Thank you.

#include <iostream>
#include<cstdlib>
#include <sstream>
#include <string>
#include <stdlib.h>
using namespace std;
void Prog10_10();
int main()



{

while (true)

{

system("cls");

cout << "\nMain Menu - Chapter 10\n";

cout << "==================================\n";

cout << " 2: Programming Exercise 10.2\n";

cout << " 4: Programming Exercise 10.4\n";

cout << " 6: Programming Exercise 10.6\n";

cout << " 7: Programming Exercise 10.7\n";

cout << " 10: Programming Exercise 10.10\n";

cout << " 12: Programming Exercise 10.12\n";

cout << " 14: Programming Exercise 10.14\n";

cout << "other: Exit\n";

cout << "==================================\n";

cout << "Enter an exercise: ";

char exercise[2];

cin >> exercise;

cout << endl;



switch (atoi(exercise))

{

//case 2: Prog10_2(); break;

//case 4: Prog10_4(); break;

//case 6: Prog10_6(); break;

//case 7: Prog10_7(); break;

case 10: Prog10_10(); break;

//case 12: Prog10_12(); break;

//case 14: Prog10_14(); break;

default: exit(0);

}

cout << endl;

system("pause");

cin.clear();

}

return 0;

}




class MyInteger
{
// int data field name value
private:
int value;
//static int numberOFObjects;
public:
//myinteger object for the specified int value
MyInteger(int value)
{
this->value = value;
}
//get function that returns the int value
int getValue()const
{
return value;
}

/*constant functions return true if the value is Prime. Static functions isPrime(int)
and isPrime(constmyinteger&) return true if the specified value is prime.*/

static bool isPrime(const MyInteger& p)
{
return isPrime(p.getValue());

}

static bool isPrime(int prime)
{
if (prime == 1 || prime == 2)
return true;
for (int i = 2; i < prime / 2; i++)
{
if (prime % i == 0)
return false;
}
return true;
}
bool isPrime()const//
{
int i = 2;//a try out
return isPrime(value % i == 0);
}

/*constant functions return true if the value isEven,static functions isEven(int)
and isEven(constmyinteger&) return true if the specified value is prime.*/
static bool isEven(int even)
{
return even % 2 == 0;
}
bool isEven()const
{
return isEven(value % 2 == 0) ? true : false;

}
static bool isEven(const MyInteger& even)
{
return isEven(even.getValue());
}
/*constant functions return true if the value is Odd. static functions isOdd(int)
and isOdd(constmyinteger&) return true if the specified value is prime. */
static bool isOdd(int odd)
{
return odd % 2 == 1;

}
bool isOdd()const
{
return isOdd(value % 2 == 1) ? true : false;


}
static bool isOdd(const MyInteger& odd)
{
return isOdd(odd.getValue());
}

/*constant functions equals(int) and equals(const myintegers&)
that return true if the value in the object is equal to the specified value.*/
bool equals(const MyInteger& even)const
{
return value == even.getValue();
}
bool equals(int num)const
{
return num == value;
}
//static function parseInt(const string&)that converts string to an int value
static int parseInt(const string& s)
{ s.c_str();
return 1;
}

};
void Prog10_10()
{
//test this program

MyInteger n1(5);
MyInteger n2(10);
cout << "n1 is " << n1.getValue() << " is " << (n1.isEven ? "Even" : "Odd" ) << endl;//<< n1.isOdd() << n1.isPrime() << n1.parseInt
//cout << "n1 is "<<n1.getValue ()<< " is " <<(n1.isEven ? "Even" :"Odd") << endl;
//cout << "n1 is even? " <<( n1.equals(10) ? " is equal" : " is not equal") << endl;
////static
//cout << "n1 is " << n1.getValue() << " is " << (MyInteger::isEven(5) ? "Even" : "Odd") << endl;
//cout << "n1 is prime? " << n1.isPrime () << endl;
//cout << "n2 is " << n2.getValue() << endl;
//cout << "n2 is even? " << n2.isEven() << endl;
//cout << "n2 is odd? " << n2.isOdd() << endl;
//cout << "n2 is prime? " << n2.isPrime() << endl;
}
Please use code tags.

Functions need () after them, even if they take no arguments. You are missing them after n1.isEven in your routine void Prog10_10().
Thanks
Topic archived. No new replies allowed.