C++ Sentinel/Count Controlled Loop beginning programming
<p>Hello all this is my first post.  I'm working on a homework assignment with the following parameters.  </p>

<blockquote>
  <p>Piecework Workers are paid by the piece.  Often worker who produce a
  greater quantity of output are paid at a higher rate.</p>

<pre><code>1 - 199 pieces completed  $0.50 each
200 - 399 $0.55 each (for all pieces)
400 - 599 $0.60 each
600 or more   $0.65 each
</code></pre>
  
  <p>Input: For each worker, input the name and number of pieces completed.</p>

<pre><code>Name          Pieces

Johnny Begood     265
Sally Great       650
Sam Klutz     177
Pete Precise      400
Fannie Fantastic  399
Morrie Mellow     200
</code></pre>
  
  <p>Output: Print an appropriate title and column headings.  There should
  be one detail line for each worker, which shows the name, number of
  pieces, and the amount earned.  Compute and print totals of the number
  of pieces and the dollar amount earned. </p>
  
  <p>Processing: For each person, compute the pay earned by multiplying the
  number of pieces by the appropriate price.  Accumulate the total
  number of pieces and the total dollar amount paid.</p>
  
  <p>Sample Program Output:</p>

<pre><code>Piecework Weekly Report

Name          Pieces  Pay

Johnny Begood     265 145.75
Sally Great       650 422.50
Sam Klutz     177 88.5
Pete Precise      400 240.00
Fannie Fantastic  399 219.45
Morrie Mellow     200 110.00

Totals            2091    1226.20
</code></pre>
  
  <p>You are required to code, compile, link, and run a sentinel-controlled
  loop program that transforms the input to the output specifications as
  shown in the above attachment.  The input items should be entered into
  a text file named piecework1.dat and the ouput file stored in
  piecework1.out . The program filename is piecework1.cpp.  Copies of
  these three files should be e-mailed to me in their original form.</p>
  
  <p>Read the name using a single variable as opposed to two different
  variables. To accomplish this, you must use the getline(stream,
  variable) function as discussed in class, except that you will replace
  the cin with your textfile stream variable name. Do not forget to code
  the compiler directive #include &lt; string > at the top of your program
  to acknowledge the utilization of the string variable, name . Your
  nested if-else statement, accumulators, count-controlled loop, should
  be properly designed to process the data correctly.</p>
</blockquote>

<p>The code below will run, but does not produce any output.  I think it needs something around line 57 like a count control to stop the loop.</p>

<p>something like (and this is just an example....which is why it is not in the code.)</p>

<pre><code>count = 1;
while (count &lt;=4)
</code></pre>

<p>Can someone review the code and tell me what kind of count I need to introduce, and if there are any other changes that need to be made.</p>

<p>Thanks.</p>

<pre><code>//COS 502-90
//November 2, 2012
//This program uses a sentinel-controlled loop that transforms input to output.

#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;iomanip&gt;  //output formatting
#include &lt;string&gt;   //string variables
using namespace std;

int main()
{

double pieces;          //number of pieces made
double rate;            //amout paid per amount produced
double pay;             //amount earned 
string name;            //name of worker
ifstream inFile;
ofstream outFile;

//***********input statements****************************
inFile.open("Piecework1.txt");  //opens the input text file
outFile.open("piecework1.out");  //opens the output text file
outFile &lt;&lt; setprecision(2) &lt;&lt; showpoint;
outFile &lt;&lt; name &lt;&lt; setw(6) &lt;&lt; "Pieces" &lt;&lt; setw(12) &lt;&lt; "Pay" &lt;&lt; endl;
outFile &lt;&lt; "_____" &lt;&lt; setw(6) &lt;&lt; "_____" &lt;&lt; setw(12) &lt;&lt; "_____" &lt;&lt; endl;
getline(inFile, name, '*');         //priming read
inFile &gt;&gt; pieces &gt;&gt; pay &gt;&gt; rate;    // ,,
while (name != "End of File")           //while condition test
{                                   //begining of loop
    pay = pieces * rate;
    getline(inFile, name, '*');     //get next name
    inFile &gt;&gt; pieces;               //get next pieces
}                                   //end of loop
inFile.close();
outFile.close();
return 0;
}
</code></pre>
