I cant figure out how to import a file which contains the price of an item. and once i import the price idk how to put it in my program. AND I DONT TO USE IT AN ARRAY. I AM IMPORTING EACH ITEM ONE AT A TIME.
void main ()
{
int itemlist, itemlistnumb=0, errorlist=0;// errorlist keeps track of errors and I HAVE TO DISPLAY THEM AT THE END.
ofstream numb_item_list ("itemlist.txt");// list of avaliable items
ofstream da_price_list ("pricelist.txt");// list of avaliable item prices
numb_item_list << " What items would you like to purchase, please type the number of the item ";
ifstream items("itemlist.txt");// takes input from user
{
if(items !=("itemlist.txt"))// if user chooses an item that is not on the list then an error occurs
{
errorlist++; // counts number of errors occur
cout<< " Error " << items << " is not a item " << endl;
}
else{
itemlistnumb++; // keeps track of items purchase
while( items == ("itemlist.txt"))
{
// how would i import the price of the item so i could do this. I have not
// declared price or curr_total i am at a wall. but i wanna use them
cout << itemnumber << "," << price << "," << curr_total << endl;
}
}
items.close();
}