title: I am trying to display the output of my addition and subtraction functions into display function
body: <p>I am trying to display the result of my addition and subtraction function when I add or subtract two fractions. However, whenever I enter the two fractions, it does not display the results. It just goes straight to the "Press any key to continue" line. I was wondering if anyone can guide me to the solution. Doing the work for me isn't necessary, but some hints would be of great help. I have been trying to figure this out for some time by looking at my code, using the internet for resources, and looking at my c++ book for a bit of help. I'm certain I am doing something wrong in the display function. Thank you for your time. </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  void info();
  void input (int ,int ,int ,int ,int , int,char, char);
  int add (int,int,int,int,int,int,char,char);
  int subtract(int,int,int,int,int,int,char, char);
  void display ();
  
  int main()
  { int num1,den1,num2,den2,num_result, den_result;
    char fraction_char;
    char operation;
  
  
  
  info();
  input (num1,den1,num2,den2,num_result,den_result,fraction_char, operation);
  add (num1,den1,num2,den2,num_result,den_result,fraction_char, operation);
  subtract(num1,den1,num2,den2,num_result,den_result,fraction_char,operation);
  display ();
  
      return 0;
  }
  
  void info()
  { cout&lt;&lt;"Please follow instructions carefully."&lt;&lt;endl;
     cout&lt;&lt;"Enter your operation like 1/2 + 1/4"&lt;&lt;endl;
     cout&lt;&lt;"You must enter a valid operation."&lt;&lt;endl;
     cout&lt;&lt;"Enter % operator to stop the program (0/1 % 0/1)"&lt;&lt;endl;
  
  }
  
  void input (int num1,int den1,int num2,int den2,int num_result, int den_result,char fraction_char, char operation)
  { cout&lt;&lt;"Please enter your operation."&lt;&lt;endl;
    cin&gt;&gt;num1&gt;&gt;fraction_char&gt;&gt;den1&gt;&gt;num2&gt;&gt;fraction_char&gt;&gt;den2;
  
  
  }
  
  int add (int num1,int den1,int num2,int den2,int num_result,int den_result,char fraction_char, char operation)
  { int addition_answer;
  
      if(operation== '+')
     {   num_result = (num1*den2) + (num2*den1);
  
         den_result = den1*den2;
        addition_answer = num_result/den_result;
     }
    return addition_answer;
  
  
  }
  
  int subtract(int num1,int den1,int num2,int den2,int num_result,int den_result, char fraction_char, char operation)
  { int subtraction_answer;
  
  
      if (operation == '-')
    { num_result = (num1*den2) - (num2*den1);
      den_result = den1*den2;
      subtraction_answer= num_result/den_result;
  
    }
      return subtraction_answer;
  }
  
  
  
  void display ()
  
  {
    int num1,den1,num2,den2,num_result,den_result,fraction_char,operation;
    int fraction_added =  add (num1,den1,num2,den2,num_result,den_result,fraction_char,operation);
    int fraction_subtracted = subtract(num1,den1,num2,den2,num_result,den_result,fraction_char,operation);
  
  
  
    if (operation== fraction_added)
  
    {
  
    cout&lt;&lt;"Your answer is: "&lt;&lt;add;
    }
  
    else if (operation== fraction_subtracted)
    {
        cout&lt;&lt;"You answer is: "&lt;&lt;subtract;
    }
      add(num1,den1,num2,den2,num_result,den_result,fraction_char,operation);
      subtract(num1,den1,num2,den2,num_result,den_result,fraction_char,operation);
  }
  </code></pre>