title: Simple Array Finding Index Position of Highest and Lowest Value
body: <p>I am trying to write a simple logical program to find the highest and lowest values, which has already been done.  The issue is how to find the index position is when it finds the highest and lowest value.  See the attached picture.
  <img src="https://i.stack.imgur.com/XSBPp.png" alt="enter image description here"></p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  
  int main()
  {
  
  int number=0, min=0, max=0;
  int *rangeOfNumbers = new int[];
  
  cout&lt;&lt;"Enter 5 numbers: ";
  
  for(int i=0; i&lt;5;i++)
  {
      cout&lt;&lt;"Enter number "&lt;&lt;i+1&lt;&lt;": ";
      cin&gt;&gt;rangeOfNumbers[i];
  }
  
  //max min array positions
  
  min=rangeOfNumbers[0];
  max=rangeOfNumbers[0];
  
  //find max and mins
  for(int j=0; j&lt;5;j++)
  {
  if(max&lt;rangeOfNumbers[j])
  {
      max=rangeOfNumbers[j];
  }
  else if(min&gt;rangeOfNumbers[j])
  {
      min=rangeOfNumbers[j];
  }
  }
  
  cout&lt;&lt;"\n\nMin number: "&lt;&lt;min;
  cout&lt;&lt;"\nMax number: "&lt;&lt;max;
  
  cin.get();
  cin.get();
  
  return 0;
  }
  </code></pre>