I have a txt file of this format:
2
Jack S123 Y 1
Choco P0001 5.50 2
Jane S456 N 2
Rice P0002 10.00 2
Chicken P0004 7.50 1
how do i create the loop to store the data into 2 classes?
my code
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < numOfPurchased; j++)
fin >> customerName >> customerID >> preniumStatus >> numOfPurchased;
c[i].setInfo(customerName, customerID, preniumStatus, numOfPurchased);
getline(fin, space);
fin >> pname >> pID >> uCost >> qPurchased;
p[j].setInfo(pname, pID, uCost, qPurchased);
}
}