// declare and open the input file
ifstream fin("filename.txt");
int num;
// Loop while a number can be read
while (fin >> num)
{
// do something with each number
cout << num << '\n';
char comma; // read and ignore
fin >> comma; // the comma separator
}