Question
Write a C++ code to implement a software for grocery store with 2 functions. Add Item Sale It is required to save data in structure
Write a C++ code to implement a software for grocery store with 2 functions.
Add Item
Sale
It is required to save data in structure with at least 4 members.
itemCode (5 digit)
itemName
quantity
price
Use file handling to save data of all products.
open file in append mode as used in following example code. If you drop the code in red color then each time a new file will be created and with code in red color same file will loaded and text will be appended at the end of file.
///////////////////////////////////////////////////////////
#include
int main () {
std::ofstream ofs;
ofs.open ("test.txt", std::ofstream::out | std::ofstream::app);
ofs << " more lines";
ofs.close();
return 0;
}
////////////////////////////////////////////////////////////
Recall the lecture in which we discussed implementation of menu printing using switch-case statement in while loop. So, you must display a menu with three options
Add Item.
Sale
Quit
On selection of Add Item option, user must be prompted to add data of item which is then saved to file.
On selection of sale user must be given two options.
Code
On selection of Code, user must be prompted to input code of item and on selection of Print, stop asking for options from Code and Print and Print the final cash memo with total price.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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