Reading a line of numbers and stopping after the end of the line
<p>Example of input:</p>

<p>I 67 85 49</p>

<p>R 4</p>

<p>D 4</p>

<p>G 65 97</p>

<p>/end input.txt</p>

<p>So I'm sure this is a elementary programming question but i've been playing with code and tried looking it up in books. But I need a way to keep reading in numbers after the I because theoretically the numbers could be endless. Now the D,G,R I can just code it to read in one number for D and R and two for G because that will never change.</p>

<p>By the way, I stands for Insert, R for Rank, D for delete, and G for Range. It's a program on BSTs. Got most of my code done except for parts of my main and little things here and there.</p>

<p>I was thinking of a while() loop in my switch to do this feat, but I'm pretty I'll have to change up my coding a bit inside the while loop. </p>

<p>I got it working so it reads in the operations perfectly.</p>

<p>Thanks for any suggestions!</p>

<p>Code:</p>

<pre><code>inFile &gt;&gt; oper;     //prime the while loop

while(!inFile.eof())
{
    switch(oper)
        {
            case 'I':   while(//something to stop at /n)
                            {
                                    inFile &gt;&gt; value;      //tests to see if it
                        outFile &lt;&lt; value; //is working correctly
                                    MainInsert(value);
                            }
                        break;
            case 'D':   
                        break;
            case 'R':   
                        break;
            case 'G':   
                        break;
            case 'F':   
                        break;
            case 'S':   
                        break;
            default:    outFile &lt;&lt; "\n Invalid Operation!" &lt;&lt; endl;
                        exit (0);
        }

    inFile &gt;&gt; oper;
}
</code></pre>
