So I have been working through notes on text files and I have came to a problem with reading multiple data from a textfile. The program has to take the surname and a value from the textfile, so my textfile looks something like this.
The pseudocode looks like this.
open salesFile for reading
while not end of file and index < max
input from salesFile into names[index]
input from salesFile into sales[index]
index=index + 1
My actual code looks like this.
Is there anyway I can take the name and store it into an array and take the number and store it into another array by using the comma to seperate the name from the number.
ifstream salesFile ("c:\\sales.txt");
index = 0;
while ((!salesFile.eof()) && (index < MAX))
getline (salesFile, names[index])
index = index + 1;
count = index;
Thanks in advance.