For my assignment i have to build a program that prompts the user for an input and output .txt file, reads data into 3 parallel arrays (name, id#, balance), and outputs data relative to whom the user searches for.
I'm having trouble reading in the data from the InFile.txt. I copied and paste an old chunk of code that worked on sothing similar to this but this was the result:
"Jean 0 1.2641e+029
0 3.76453e-039
1875687368 1.25968e+029
2686504 1.26428e+029
1875607209 3.76454e-039
0 3.76455e-039
6 1.2641e+029
1875687368 8.40779e-045
1875655176 0
1875685200 8.40779e-045"
This is what is in InFile.txt:
Jean Rousseau
1001 15.50
Steve Woolston
1002 1423.20
Michele Rousseau
1005 52.75
Pete McBride
1007 500.32
Florence Rousseau
1010 1323.338
Lisa Covi
1009 332.356
Don McBride
1003 12.32
Chris Carroll
1008 32.356
Yolanda Agredano
1004 356.00
Sally Sleeper
1006 32.362
for(int index = 0; index < 10; index++)
{
getline(infile, nameArray[index]);
infile >> IDArray[index] >> balanceArray[index];
infile.ignore(1024, '\n'); // to skip the rest of the line
}