The code below takes the quantity of tickets from the 55 tickets that is available and it stores the value in a text file. What I want the program to do is to store the amount of tickets that is available and then each time the program executes it will take away from the remaining tickets that is available. Thanks

AmountOfTickets = 55; 

 NewAmountOfTickets = AmountOfTickets - AdditonalAdultQty - AdditonalChildQty - AdditonalSeniorQty - AdditonalFamilyQty - AdultQty - ChildQty - SeniorQty - FamilyQty;   
     
         ofstream myfile1;
 
         myfile1.open ("Tickets Left.txt");
 
         myfile1 << NewAmountOfTickets;
 
         myfile1.close();
        
         NewAmountOfTickets1 = NewAmountOfTickets - AmountOfTickets - AdditonalAdultQty - AdditonalChildQty - AdditonalSeniorQty - AdditonalFamilyQty - AdultQty - ChildQty - SeniorQty - FamilyQty;
        
         ifstream inFile("Tickets Left.txt");
 
         inFile>> NewAmountOfTickets;
 
         inFile.close();

Sounds like you want to delete a value from the file "Tickets Left.txt". To do this, you'll have to make a new file, copy everything across that you want copied across, delete the old one and then name the new one with the same name.

Could you show me an example of this? Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.