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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started