title: need help calling functions from class
body: <p>I'm having trouble picking the functions from <code>class OperateClass</code></p>
  
  <p>It asks the user "Do you want to add, subtract, multiply or divide? I want to :" (in main). No matter what I put, it goes to the function <code>int add</code>. What am I doing wrong?  </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int x = 1;
  int number;
  int total = 0;
  int amt = 1;
  int a;
  int b;
  int c;
  int d;
  string ans;
  
  class OperateClass{
      public:
          int add(){
              while(x &lt;= 2){
                  cout &lt;&lt; "Enter a number to use to add: " &lt;&lt; endl;
                      cin &gt;&gt; a;
                  total = total + a;
                  x++;
                  amt++;
              }
          }
  
          int subtract(){
              while(x &lt;= 2){
                  cout &lt;&lt; "Enter a number to use to add: " &lt;&lt; endl;
                      cin &gt;&gt; b;
                  total = total - b;
                  x++;
                  amt++;
              }
          }
  
          int multiply(){
              while(x &lt;= 2){
                  cout &lt;&lt; "Enter a number to use to add: " &lt;&lt; endl;
                      cin &gt;&gt; c;
                  total = total * c;
                  x++;
                  amt++;
              }
          }
  
          int divide(){
              while(x &lt;= 2){
                  cout &lt;&lt; "Enter a number to use to add: " &lt;&lt; endl;
                      cin &gt;&gt; d;
                  total = total / d;
                  x++;
                  amt++;
              }
          }
  };
  
  int main()
  {
  
  cout &lt;&lt; "Do you want to add, subtract, multiply or divide? I want to : " &lt;&lt; endl;
  cin &gt;&gt; ans;
  
  if(ans == "add"){
  OperateClass opOper;
  opOper.add();
      }
  
  else if (ans == "subtract"){
      OperateClass opOper;
      opOper.subtract();
      }
  
  else if (ans == "multiply"){
      OperateClass opOper;
      opOper.multiply();
      }
  
  else if(ans == "divide"){
      OperateClass opOper;
      opOper.divide();
  
      }
  
  }
  </code></pre>
  
  <p>also, is this below function good enough to print?</p>
  
  <pre><code>void print(){
      cout &lt;&lt; "Your total is: " &lt;&lt; total &lt;&lt; endl;  Where should I call this?
  
  }
  </code></pre>