I would like to store the below txt file into a few arrays using C++ but I could not do it as the white space for the item name will affect the storing.
Monday //store in P1 string
14-February-2022 //store in P2 string
Red Chilli //store in P3 array, problem occurs here as i want this whole line to be store in the array
A222562Q //store in P4 array
1.30 2.00 //store in P5 and P6 array
Japanese Sweet Potatoes //repeat storing for Item 2 until end of the file
B807729E
4.99 1.80
Parsley
G600342k
15.00 1.20
Below is the coding I have tried to do to store the data in the array. It might not be the best way. Can provide me a better ways to store the data. Thanks
ifstream infile;
infile.open("itemList.txt");
infile >> P1;
infile >> P2;
for (int i = 0; i < sizeof(P3); i++) {
infile >> P3[i];
infile >> P4[i];
infile >> P5[i];
infile >> P6[i];
}