Question: C++ Coffe shop menu, where the user inputs their order and it is written to a .dat file. I gotten thru most of it, but

C++ Coffe shop menu, where the user inputs their order and it is written to a .dat file. I gotten thru most of it, but the second part is that when the user doesn't want to order a coffee, they have the option to just view the order or add up all the totals from the .dat file and display it on screen. I'm getting stuck here because I don't know how to read just a certain line from a .dat file and then add the numbers in that line. Ex of how the file looks Order1# Coffeename: blah ..... Cost: $3.09 Order2# Coffeename: blah ..... Cost: $4.09 So I would have to add up 3.09 and 4.09 and display it to the user. I got this so far coffee.open("coffee.dat", ios::in); if(custOrder) { //Read an item from the file getline(coffee, calcPrice(c)); <- the cost function in my code while(coffee) { cout<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!