title: Error: control reaches end of non-void function?
body: <p>This is my assignment : " Write a function that finds the larger of two integers input (in the main program) but allows you to change the value of the integers in the function using pass by reference." I been trying to find out whats wrong with my code but I cant find out what it is. Someone please help me !! this assignment is due tonight!! 
  Here is my code as of right now :</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int change(int&amp; x, int&amp; y)
  
  {
      int temp=0;
  
      cout &lt;&lt; "Function(before change): " &lt;&lt; x &lt;&lt; " " &lt;&lt; y &lt;&lt; endl;
  
      temp = x;
      x = y;
      y = temp;
  
      cout &lt;&lt; "Function(after change): " &lt;&lt; x &lt;&lt; " " &lt;&lt; y &lt;&lt; endl;
  
  }
  
  int main()
  
  {
      int x,y;
  
      cout &lt;&lt; " Please Enter your first number: ";
      cin &gt;&gt; x;
  
      cout &lt;&lt; " Please Enter your second number: ";
      cin &gt;&gt; y;
  
      if (x &gt; y)
          cout &lt;&lt; x &lt;&lt; " is greater than " &lt;&lt; y &lt;&lt; endl;
  
      if (x &lt; y)
          cout &lt;&lt; y &lt;&lt; " is greater than " &lt;&lt; x &lt;&lt; endl;
  
      if (x == y)
          cout &lt;&lt; x &lt;&lt; " is equal to " &lt;&lt;y &lt;&lt; endl;
  
      cout &lt;&lt; "Main (before change): " &lt;&lt; x &lt;&lt; " " &lt;&lt; y &lt;&lt; endl;
      change(x, y);
  
      cout &lt;&lt; "Main (after change): " &lt;&lt; x &lt;&lt; " " &lt;&lt; y &lt;&lt; endl;
  
      system("Pause");
  
      return 0;
  
  }
  </code></pre>