Were going to do an inventory management system. In the real world, this would use a database, not a file. Inventory containsitem names (or description), like socks, red or socks blue. Thius has to be a character string that WILL include spaces.item numbers that are unique to the item, similar to UPC codes, like 121821 or 128122. These are usually character strings.a price, like 4.99, a double.a quantity on hand, like 13, an integer.Your code need to have the following features, all accessible from a menu.Add a new inventory item to the data in memory. Youll type in the inventory number, description, quantity and price. This will also update the number of items on the menu screen. List the inventory on the screen in neat columns. Display it in chucks of 15 items with a pause in between.Search the inventory for an item by inventory number. If found, print the stored info, otherwise print not found.Calculate the total value on hand. The sum is the accumulation of all the (quantities * prices).Save whats in memory to the diskOverwrite whats in memory from the diskThe way your work this is youll load a file, add, search, etc, then write it back to disk. Ideas:An array of objects works nicely if you read ahead, although this isnt required, see my code below (sorry about the indenting).Heres a sample menu:===========================1) Add an item to memory2) Search memory for an item3) List whats in memory4) Total value on hand5) Save to a file6) Read in from a file0) Exit Program56 items stored #include #include #include using namespace std; class invItem{ public: string name; string number; double price; int quantity;}; void printItem(invItem someitem); int main(){ /// read in one record st
ring itemName; string itemNumber; double itemPrice; int itemQuantity; /// read in a single record from a file string inputBuffer; ifstream invFile(invent1.txt); /// declares and opens getline(invFile, itemName); getline(invFile, itemNumber); getline(invFile, inputBuffer); itemPrice = atof(inputBuffer.c_str()); getline(invFile, inputBuffer); itemQuantity = atoi(inputBuffer.c_str()); cout << Item = << itemName << [ << itemNumber <<] << endl; cout << Quantity = << itemQuantity << @ << itemPrice << = << itemPrice * itemQuantity; invFile.close(); /// write a single record to a file ofstream invOutFile(invent1.txt, ios::app); /// declare and open for append invOutFile << White Sox << endl; invOutFile << 82452374293742 << endl; invOutFile << 6.99 << endl; invOutFile << 20 << endl; invOutFile.close(); /// build a single invItem object invItem someitem; someitem.name=Green Socks; someitem.number=5435234523452345?; someitem.price=5.99; someitem.quantity=67; printItem(someitem); /// build an array of invItem objects and save one to disk invItem items[1000]; items[0].name=Yellow Socks; items[0].number=25435567456723452345?; items[0].price=7.99; items[0].quantity=27; printItem(items[0]); ofstream invOutFile2(invent1.txt, ios::app); /// declare and open for append invOutFile2 << items[0].name << endl; invOutFile2 << items[0].number << endl; invOutFile2 << items[0].price << endl; invOutFile2 << items[0].quantity<< endl; invOutFile2.close(); return 0;} void printItem(invItem someitem){ cout << Item = << someitem.name << [ << someitem.number <<] << endl; cout << Quantity = << someitem.quantity << @ << someitem.price << = << someitem.price * someitem.quantity << endl; }