title: Finding MAX of numbers without conditional IF statements c++
body: <p>So i have too get two numbers from user input, and find the max of the two numbers without using if statements.</p>
  
  <p>The class is a beginner class, and we have too use what we already know. I kinda worked something out, but it only works if the numbers are inputted with the max number first. </p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  
  int main()
  {
  int x = 0, y = 0, max = 0;
  int smallest, largest;
  
  cout &lt;&lt; "Please enter 2 integer numbers, and i will show you which one is larger:      ";
  cin &gt;&gt; x &gt;&gt; y;
  
  smallest = (x &lt; y == 1) + (x - 1);
  smallest = (y &lt; x == 1) + (y - 1);
  
  largest = (x &lt; y == 1) + (y - 1);
  largest = (y &gt; x == 1) + (x + 1 - 1);
  
  cout &lt;&lt; "Smallest: " &lt;&lt; smallest &lt;&lt; endl;
  cout &lt;&lt; "Largest: " &lt;&lt; largest &lt;&lt; endl;
  
  
  
  return 0;
  }
  </code></pre>
  
  <p>Thats what i have so far, but after putting different test data in, i found out it only works for numbers such as 4,5 or 6,7. But numbers with more then 2 spaces between eachother they dont such as, 4,8 or 5, 7. Any help would be appreciated.</p>