title: Min and Max Loop
body: <p>I am writing code for an assignment that wants me to make a program that asks the user for the amount of integers they'd like to input then it accepts each input while testing if the value is the max value or minimum. My program runs fine for every integer entered besides 1. When i input the int 1 only the max value is recorded even though the number inputted is technically the minimum as well, this is due to the if statement causing the loop to reiterate once it founds out if the number is the max or min and in this case the number will always be the max so the test never runs again. How can i fix this? </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      int input;
      int tmp;
      int counter = 1;
      int max_num=0;
      int min_num;
  
      //prompt user for integer amount
      cout &lt;&lt; "How many integers would you like to enter? " &lt;&lt; endl;
      cin &gt;&gt; input;
      cout&lt;&lt; "Please enter " &lt;&lt; input &lt;&lt; " integers." &lt;&lt; endl;
  
      tmp = input;
  
  
  //loop for requested amount with a test for each input
      while (counter &lt;= tmp){
          cin &gt;&gt; input;
  //if smaller than previous number it is the minimum
          if (input &lt; min_num){
              min_num = input;
              counter++;
          }
  
  // if larger than previous number it becomes max number
          else if (input &gt; max_num){
              max_num = input;
              counter++;
          }
  
  
  //continue loop if number isn't bigger than max or smaller than min
          else {
             counter++;
          }
  
  
  
      }
  
  //display the max and min
      cout &lt;&lt; "min: "&lt;&lt; min_num &lt;&lt; endl;
      cout &lt;&lt; "max: " &lt;&lt; max_num&lt;&lt; endl;;
  
  
  
      return 0;
  }
  </code></pre>