O
ofranko
i'm trying to overload fx "myAnswer"... i want to return - int
myAnswer when
myAnswer== sumOf ..... when they are != i want the message
"Incorrect..." to be returned..
i've included some of the code ..if you need more just ask..
thank you for your help,
frank
i'll continue working on it..if i get i'll let you know
class AddingNumbers
{
public:
AddingNumbers(int initialRandomNumber, int initialAddTable,
int initialsumOf, int initialMyAnswer);
~AddingNumbers();
int GetRandomNumber();
void SetRandomNumber(int randomNumber);
int GetAddTable() ;
void SetAddTable(int addTable);
int GetsumOf();
void SetsumOf(int sumOf);
int GetMyAnswer();
//string GetMyAnswer();
void SetMyAnswer(int myAnswer);
private:
int theRandomNumber;
int theAddTable;
int theSumOf;
int theMyAnswer;
};
string AddingNumbers::GetMyAnswer()
{
myAnswer ="Incorrect, Try Again ";
cout << myAnswer<<endl;
}
int AddingNumbers::GetMyAnswer()
{
int myAnswer = 0;
cout << "What is the Sum of " << theAddTable <<" + " <<
theRandomNumber << " ?" <<'\n';
cin >> myAnswer;//system("pause");
if (myAnswer == theSumOf)
{
cout << "CORRECT!," <<'\n'<< "Next"<<'\n'<<'\n';
cout << theAddTable << " + " << theRandomNumber << " = " <<
theSumOf << '\n';
//countedCorrect ++;
return myAnswer;
}
else
{
cout <<" Incorrect," <<'\n' << "Next " <<'\n'<<'\n';
cout << theAddTable << " + " << theRandomNumber << " = "<<
theSumOf << '\n';
}
return myAnswer;
}
myAnswer when
myAnswer== sumOf ..... when they are != i want the message
"Incorrect..." to be returned..
i've included some of the code ..if you need more just ask..
thank you for your help,
frank
i'll continue working on it..if i get i'll let you know
class AddingNumbers
{
public:
AddingNumbers(int initialRandomNumber, int initialAddTable,
int initialsumOf, int initialMyAnswer);
~AddingNumbers();
int GetRandomNumber();
void SetRandomNumber(int randomNumber);
int GetAddTable() ;
void SetAddTable(int addTable);
int GetsumOf();
void SetsumOf(int sumOf);
int GetMyAnswer();
//string GetMyAnswer();
void SetMyAnswer(int myAnswer);
private:
int theRandomNumber;
int theAddTable;
int theSumOf;
int theMyAnswer;
};
string AddingNumbers::GetMyAnswer()
{
myAnswer ="Incorrect, Try Again ";
cout << myAnswer<<endl;
}
int AddingNumbers::GetMyAnswer()
{
int myAnswer = 0;
cout << "What is the Sum of " << theAddTable <<" + " <<
theRandomNumber << " ?" <<'\n';
cin >> myAnswer;//system("pause");
if (myAnswer == theSumOf)
{
cout << "CORRECT!," <<'\n'<< "Next"<<'\n'<<'\n';
cout << theAddTable << " + " << theRandomNumber << " = " <<
theSumOf << '\n';
//countedCorrect ++;
return myAnswer;
}
else
{
cout <<" Incorrect," <<'\n' << "Next " <<'\n'<<'\n';
cout << theAddTable << " + " << theRandomNumber << " = "<<
theSumOf << '\n';
}
return myAnswer;
}