Hello,
I'm working on a project and the value of num is AdditonalAdultQty + AdultQty (AdditonalAdultQty and AdultQty will be inputted from the user) Then those two values will be stored in the text file. When the program runs again and a different user will input how many tickets he would like then AdditonalAdultQty + AdultQty will be added together and that value will be added to the stored data in the text file. The purpose of this is to find out how many tickets are sold for the adult category for the day. I don't know what I'm doing wrong with the code. How can I do this?
void SoldTickets ()
{
TotalAdultTicketsSold = AdditonalAdultQty + AdultQty;
ofstream myfile;
myfile.open ("Sold Tickets.txt");
myfile << "Sold tickets for adult:"<< TotalAdultTicketsSold;
myfile.close();
fstream indata("Sold Tickets.txt",ios::in);
float num;
indata >> num;
TotalNo = num + TotalAdultTicketsSold;
indata << TotalNo;
indata.close();
Thanks