why is this loop only executing once???

here is my code, it supposed to execute at least 5 times


1
2
3
4
5
6
	ifstream List;
		List.open("Mailings.txt");
		
while(List >> Name >> LName >> Snum >> Address >> Drive>> City>> State >> zip1 >> Envelopesrice >> ounces){
cout << Name << " " << LName << "\n"<< Snum << " " << Address << " " << Drive <<"\n" << City << " " << State << " " << zip1 << "\n";
		}
Last edited on
I'm guessing it's because your data file is too short.

It's hard to tell because you only gave us 4 lines of code and didn't show us the contents of the data file.
@Doug4

sorry here is the content off the file

Ann Perkins
217 Lowell Drive
Pawnee
IN
47408
3
4.2

Ron Swanson
3657 White Bridge Road
Eagleton
IN
47320
2
2.3

Andy Dwyer
789 Cherry Road
Wamapoke
IN
48034
1
1.8

Ben Wyatt
1513 Plymouth Street
Pawnee
IN
47407
1
1

Chris Traeger
8900 Rapport Street
Eagleton
IN
47322
3
3
"White Bridge Road" is going to mess up your reading, because it's 3 words rather than two.
Topic archived. No new replies allowed.