Quiz program always evaluating answer to be wrong
<pre><code>class Question{
  protected:
          int op1;
          int op2;
          string operate;
  public:
     Question();
};
class generateRandomQuiz:Question{
public: 
     generateRandomQuiz();
     int getp1();
     int getp2();
       string getOp();
}; 

class checkAnswer:generateRandomQuiz{
private:
      int Ans;
public:
     checkAnswer(int ans);
};

Question::Question()
 {
  op1=23;
 op2=12;
 operate="/";
 }

generateRandomQuiz::generateRandomQuiz():Question()
{
 op1=rand()%50;
 op2=rand()%50;
   string s="+-/*";
 int n=rand()%4;
 operate=s[n];
}

int generateRandomQuiz::getp1()
{
return op1;
}

int generateRandomQuiz::getp2()
{
return op2;
}

string generateRandomQuiz::getOp()
{
  return operate;
}

checkAnswer::checkAnswer(int ans):generateRandomQuiz()
{
Ans=ans;                       
string operate=getOp();
int op1=getp1();
int op2=getp2();
if (operate=="+")
{
     if (op1+op2==Ans)
    {
        cout&lt;&lt;"Your answer is correct."&lt;&lt;endl;
    }
    else
    {
        cout&lt;&lt;"You can do better next time."&lt;&lt;endl;
    }
}
if (operate=="-")
{
      if (op1-op2==Ans)
    {
        cout&lt;&lt;"Your answer is correct."&lt;&lt;endl;
    }
    else
    {
        cout&lt;&lt;"You can do better next time."&lt;&lt;endl;
    }
 }
 if (operate=="*")
{
    if (op1*op2==Ans)
    {
        cout&lt;&lt;"Your answer is correct."&lt;&lt;endl;
    }
    else
    {
        cout&lt;&lt;"You can do better next time."&lt;&lt;endl;
    }
}if (operate=="/")
{
    if (op1/op2==Ans)
    {
        cout&lt;&lt;"Your answer is correct."&lt;&lt;endl;
    }
    else
    {
        cout&lt;&lt;"You can do better next time."&lt;&lt;endl;
    }
  }                                                                
}
 int main()
{
  cout&lt;&lt;"This quiz is about evaluating an expression which is being generatedrandomly" 
   &lt;&lt;endl;

   generateRandomQuiz Q;
   int answer;
   int op1=Q.getp1();
   int op2=Q.getp2();
   string opr=Q.getOp();
   cout&lt;&lt;"What is: "&lt;&lt;op1&lt;&lt;op2&lt;&lt;op2&lt;&lt;"=?"&lt;&lt;endl;
   cin&gt;&gt;answer;
   checkAnswer A(answer);

system("PAUSE");
return 0;
}
</code></pre>

<p>I am writing a program which generates a quiz randomly and asks the user for an answer answer like this: What is : 15 / 43 = ? The operator and numbers are randomly generated.But when i givw the correct answer,even then the comment for the wrong answer is printed.I have written conditions quite clear.Can someone please point it out?thanks</p>
