I am trying to do this project for my c++ class in college, and I am having trouble reading a text file line by line, and then outputting the text from the file to the console. Here is the code I have:
void readFile()
{
 cout << "Reading Text File" << endl <<  endl;
 int huge, large, medium, small,  remainder; 
 string line0, line1, line2, line3, line4, line5, line6, numberOrdered;
ifstream fin;
fin.open("DoflingyOrder.txt");
while(getline(fin,numberOrdered))
{
    getline(fin, line1);
    cout << "Name: " << line1  << endl;
    getline(fin, line2);
    cout << "Street Address: " << line2  << endl;
    getline(fin, line3);
    cout << "City, State and Zip Code: " << line3  << endl;
    getline(fin, numberOrdered);
    cout << "Number of Doflingies Ordered: " << numberOrdered  << endl << endl;
}
It ignores the names in the text file, which mean it is a line off. Any suggestions? I can upload the text file and .cpp file to a dropbox if anyone need it.
Here is a sample of the text file:
Leslie Knope 1456 Plymouth Street Pawnee, IN 47408 356
Ann Perkins 217 Lowell Drive Pawnee, IN 47408 9
Tom Haveford 689 Lil Sebastian Avenue Pawnee, IN 47408 1100
There is NO SPACE before "Leslie Knope".
 
     
     
     
    