title: Find duplicate in array if there is one and display it C++
body: <p>my program takes in values from a input file and passes them to an array called gpa. I have created a function that finds the smallest value in the gap array and displays it, but I also need to display a duplicate value if there is one. How would I do this.</p>
  
  <p>Thank you in advance</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  
  void lowestGpa(string names[], double gpa[], int SIZE){
      int count;
      double lowest = gpa[0];
      string name;
  
      for (count = 0; count &lt; SIZE; count++)
      {
          if (gpa[count] &lt;= lowest)
          {
              lowest = gpa[count];
              name = names[count];
          }
      }
  
      cout &lt;&lt; name &lt;&lt; " " &lt;&lt; lowest;
  }
  
  int main()
  {
      ifstream infile;
      infile.open("GPA.txt");
  
      int const SIZE = 15;
      string names[SIZE];
      double gpa[SIZE];
  
      while (infile)
      {
          for(int i = 0; i &lt; SIZE; i++)
          {
              infile &gt;&gt; names[i] &gt;&gt; gpa[i];
          }
      }
  
      lowestGpa(names, gpa, SIZE);
  
      infile.close();
  
      return 0;
  }
  </code></pre>