Why Doesn't My Program Work Correctly
<p>My program needs to parse a csv file and identify a missing combination of numbers. Order doesn't matter.</p>

<p>The program compiles and runs, but prints out numbers that are already printed in a line in the file.</p>

<p><strong>Input (mega2.csv):</strong></p>

<pre><code>123
134
142
</code></pre>

<p><em>Note <code>234</code> isn't in the list.</em></p>

<p><strong>Expected output:</strong>
The program is supposed to output <code>234</code> since it's the only combination not used. Instead nothing outputs.</p>

<p><strong>Code:</strong></p>

<pre><code>#include &lt;iostream&gt;
#include &lt;iomanip&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &lt;cstdlib&gt;
#include &lt;ctime&gt;
#include &lt;cmath&gt;
using namespace std;

int main()
{ 

    ifstream inFile; 
    string value;
    string fileName;
    int count;
    int amount, playCount;
    int a,b,c,d,e,f,g,h,i,j,k,l;
    srand(time(0));
    char ch;


do{

    cout &lt;&lt; "Enter number of plays (or -number to quit): ";

    cin &gt;&gt; amount;

    cout &lt;&lt; endl;

    playCount = 1;

    while( playCount &lt;= amount ){

        do{

            inFile.open("mega2.csv");

            //create random numbers a,b,c,d,e,f= mega num &lt; 10

            a = rand() % 5;

            if(a == 0){a = 1;}

            do{
            b = rand() % 5;

            if(b == 0){b = 1;}
            }while(b == a);

            do{
            c = rand() % 5;

            if(c == 0){c = 1;}
            }while(c == a || c == b);




            //Load numbers into g,h,i,j,k,l

            do{


            inFile &gt;&gt; g;
            inFile.get(ch);
            inFile &gt;&gt; h;
            inFile.get(ch);
            inFile &gt;&gt; i;
            inFile.get(ch);

        int count = 0;

        cout &lt;&lt; g &lt;&lt; "," &lt;&lt; h &lt;&lt; "," &lt;&lt; i &lt;&lt; endl;



    //A     
    if( a == g || a == h || a == i ){

        count++;
    }

    //B 
    if( b == g || b == h || b == i ){

        count++;
    }

    //C 
    if( c == g || c == h || c == i ){

        count++;
    }



}// close second half do loop

    while(inFile &amp;&amp; count &lt; 3);

    inFile.close();
    inFile.clear();


} // close whole do loop

    while(count &gt;= 3);

    cout &lt;&lt; endl;
    cout &lt;&lt; endl;
    cout &lt;&lt; endl;

    cout &lt;&lt; a &lt;&lt; "," &lt;&lt; b &lt;&lt; "," &lt;&lt; c &lt;&lt; endl;

    cout &lt;&lt; endl;

    playCount++;

} // End playCount while loop

}// End main do loop

while(amount &gt;= 0); // quit program with negative number

    system("pause");
    return 0;
}
</code></pre>
