title: Finding Least and Greatest for one array in a two-dimensional array
body: <p>So, this is an assignment from school that I've been trying to figure out how to make work...</p>
  
  <p>I have two different arrays going: One with strings, the other with integers.</p>
  
  <p>After getting user input on how much of each salsa was sold, I then needed to:</p>
  
  <ol>
  <li><p>Create a properly-formatted table showing how much of each salsa was sold</p></li>
  <li><p>Show the total amount of all salsas sold</p></li>
  <li><p>Show what was the most amount of salsa sold and which was the least amount.</p></li>
  </ol>
  
  <p>It compiles just fine, but it keeps spitting out strange answers for Least and Greatest salsas sold.</p>
  
  <p>I'm not quite sure how to make this work... What's the right way to tackle this?</p>
  
  <p>Thank you for any input in advance!</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;iomanip&gt;
  using namespace std;
  
  
  int main()
  {
  string salsa[5] = {"mild", "medium", "sweet", "hot", "zesty"}; //x-values
  int jars[5] = {0}; //y-values
  
          cout &lt;&lt; "\nHow many jars of mild salsa were sold?: ";
              cin &gt;&gt; jars[0];
          while (jars[0] &lt; 0)
          {
              cout &lt;&lt; "\nHow many jars of mild salsa were sold?: ";
              cin &gt;&gt; jars[0];
          }
  
          cout &lt;&lt; "\nHow many jars of medium salsa were sold?: ";
              cin &gt;&gt; jars[1];
          while (jars[1] &lt; 0)
          {
              cout &lt;&lt; "\nHow many jars of medium salsa were sold?: ";
              cin &gt;&gt; jars[1];
          }
  
          cout &lt;&lt; "\nHow many jars of sweet salsa were sold?: ";
              cin &gt;&gt; jars[2];
          while (jars[2] &lt; 0)
          {
              cout &lt;&lt; "\nHow many jars of sweet salsa were sold?: ";
              cin &gt;&gt; jars[2];
          }
  
          cout &lt;&lt; "\nHow many jars of hot salsa were sold?: ";
              cin &gt;&gt; jars[3];
          while (jars[3] &lt; 0)
          {
              cout &lt;&lt; "\nHow many jars of hot salsa were sold?: ";
              cin &gt;&gt; jars[3];
          }
  
          cout &lt;&lt; "\nHow many jars of zesty salsa were sold?: ";
              cin &gt;&gt; jars[4];
          while (jars[4] &lt; 0)
          {
              cout &lt;&lt; "\nHow many jars of zesty salsa were sold?: ";
              cin &gt;&gt; jars[4];
          }
  
          cout &lt;&lt; left;
          cout &lt;&lt; "\n" &lt;&lt;
          setw(7) &lt;&lt; "[Spice] " &lt;&lt; setw(6) &lt;&lt; "       [Jar]" &lt;&lt; '\n' &lt;&lt;
          setw(7) &lt;&lt; salsa[0]   &lt;&lt; setw(10) &lt;&lt; " " &lt;&lt; jars[0] &lt;&lt; '\n' &lt;&lt;
          setw(7) &lt;&lt; salsa[1]  &lt;&lt; setw(10) &lt;&lt; " " &lt;&lt; jars[1] &lt;&lt; '\n' &lt;&lt;
          setw(7) &lt;&lt; salsa[2]   &lt;&lt; setw(10) &lt;&lt; " " &lt;&lt; jars[2] &lt;&lt; '\n' &lt;&lt;
          setw(7) &lt;&lt; salsa[3]  &lt;&lt; setw(10) &lt;&lt; " " &lt;&lt; jars[3] &lt;&lt; '\n' &lt;&lt;
          setw(7) &lt;&lt; salsa[4]   &lt;&lt; setw(10) &lt;&lt; " " &lt;&lt; jars[4] &lt;&lt; '\n' &lt;&lt; "\n";
  
  cout &lt;&lt; "Total sales: " &lt;&lt; jars[0] + jars[1] + jars[2] + jars[3] + jars[4] &lt;&lt; "\n\n";
  
  
  //------------------------------------------------
  
  
      int highest;
      highest = jars[0];
      for (int count = 0; count &lt; 5; count++)
      {
          if (jars[count] &gt; highest)
              highest = count;
      }
  
      int lowest;
      lowest = jars[0];
      for (int count = 0; count &lt; 5; count++)
      {
          if (jars[count] &lt; lowest)
              lowest = count;
      }
  
  //------------------------------------------------
  
      cout &lt;&lt; salsa[highest] &lt;&lt; " was sold the most." &lt;&lt; "\n";
      cout &lt;&lt; salsa[lowest] &lt;&lt; " was sold the least." &lt;&lt; "\n\n";
  
  return 0;
  }
  </code></pre>
  
  <p>The output looks like this:</p>
  
  <pre><code>How many jars of mild salsa were sold?: 2
  
  How many jars of medium salsa were sold?: 4
  
  How many jars of sweet salsa were sold?: 6
  
  How many jars of hot salsa were sold?: 8
  
  How many jars of zesty salsa were sold?: 10
  
  [Spice]        [Jar]
  mild             2
  medium           4
  sweet            6
  hot              8
  zesty            10
  
  Total sales: 30
  
  zesty was sold the most.
  sweet was sold the least.
  
  Program ended with exit code: 0
  </code></pre>
  
  <p>It should be saying "mild" was sold the least, not "sweet".</p>