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.

Ogilvie, 1000
O’Donovan, 1000
Day, 15000
Zarrug, 12000
MacGregor, 5000
Friel, 6000

The pseudocode looks like this.

readInFile
open salesFile for reading
index=0
while not end of file and index < max
input from salesFile into names[index]
input from salesFile into sales[index]
index=index + 1
end-while
count=index
close salesFile

My actual code looks like this.

Code:
 void readInFile()
{
	ifstream salesFile ("c:\\sales.txt");
	index = 0;
	while ((!salesFile.eof()) && (index < MAX))
	{
		getline (salesFile, names[index])
		
		index = index + 1;
	}
	count = index;
	salesFile.close();
}
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.

Thanks in advance.