I wrote the code to a program that originally took information saved in a text file and stored it in an array. My professor wants us to use the same program but now instead of using a parallel arrays to store the information, he would like us to store the information from the text file into a structure and use it in the program. what im having trouble with currently is understanding how to save the information from the text file line by line into the structure..
using namespace std;
double userPounds, userPrice, userDiscount, userTotal, userInput, userTotalPounds, userFinal;
int number = 0;
bool trueValue, falseValue;
char again, sign, done;
int i = 0;
int currentItem;
number++; }
//i know this part is wrong but it was me trying different things to see if i could get it right. our book doesnt provide much information on how to do this step
okay thanks for your help and creating the storage worked but now im having another issue, later on in the code when im trying to use the structures it wont compile. I tried switching Item to item there too but that didnt work.
1 2 3 4 5 6 7 8 9
for (int i = 0; i < PRODUCT; i++) {
if (userInput == Item.plucode[i]) {
currentItem = i;
}
}
cout << "How many pounds of " << Item.name[currentItem] << " would you like?" << endl;
cin >> userPounds;
userPrice = Item.price[currentItem] * userPounds;
Ive gotten the progam to run correctly. Lastly Im trying to take the information stored in the structure and output it into another file. but since its several lines of information how would i create a loop that would output the entire data structure until theres nothing left?