title: Check if scores are between 0 and 100 using pointers
body: <p>I need to check each score value, they need to be between 0 and 100 and if not the user needs to be prompted to reenter a valid value.</p>
  <p>My code:</p>
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  void sort(int*, int);
  void displaySort(int*, int);
  
  int main()
  {
      int lInput;
      cout &lt;&lt; &quot;Enter the size of your list: &quot;;
      cin &gt;&gt; lInput;
  
      int* lPtr = new int[lInput];
  
      for (int i = 0; i &lt; lInput; i++)
      {
          cout &lt;&lt; &quot;Enter a score: &quot;;
          cin &gt;&gt; *(lPtr + i);
  
          if (*(lPtr + i) &lt; 0 || *(lPtr + i) &gt; 100)
          {
              cout &lt;&lt; &quot;Invalid input, enter again: &quot;;
          }
      }
  
      cout &lt;&lt; endl;
  
      sort(lPtr, lInput);
      displaySort(lPtr, lInput);
  
      cout &lt;&lt; endl;
  
      delete[] lPtr;
  
  
      system(&quot;PAUSE&quot;);
      return 0;
  }
  
  void sort(int* array, int size)
  {
      int scan, minIndex, minValue;
  
      for (int scan = 0; scan &lt; (size - 1); scan++)
      {
          minIndex = scan;
          minValue = *(array + scan);
          for (int i = scan + 1; i &lt; size; i++)
          {
              if (*(array + i) &lt; minValue)
              {
                  minValue = *(array + i);
                  minIndex = i;
              }
          }
          *(array + minIndex) = *(array + scan);
          *(array + scan) = minValue;
      }
  }
  
  void displaySort(int* array, int size)
  {       
      cout &lt;&lt; &quot;List of scores in ascending order:&quot; &lt;&lt; endl;
  
      for (int i = 0; i &lt; size; i++)
      {
          cout &lt;&lt; *(array + i) &lt;&lt; &quot; &quot;;
      }
  }
  </code></pre>
  <p>The way I have it now, it still takes the invalid number. I want it so if an invalid number is entered it does not take the number and asks for a valid one.</p>