Answered step by step
Verified Expert Solution
Question
1 Approved Answer
can you fix my code void marketdatabase (vectorf string arcode; int gnount; double price; string itemname; cout Enter product QR, name, and price (enter 'END'
can you fix my code void marketdatabase (vectorf string arcode; int gnount; double price; string itemname; cout "Enter product QR, name, and price (enter 'END' to finish): " ; string line; while (true) \& getline(cin, line); if (line = "END") break; itemname =1 ine. substx (1ine.find(' ') +1,1 ine.find('\$') -1 ine.find(' ') - 1); price =stod(1 ine.substr (1 ine.find ( 's' )+1)); qreodes,push_back(qrcode); itens .push_back (itemname); prices.push back(price); ) int finderCodoIndex(const vectorf for (size ti=0;i(i); \} ) return -1 : BD 4 ) (8) 11 Une: 54 Col: 27 Execption =( vold ) Oxi 18ec3a2ce 1ibor+abi: terminating due to uneaught exeeption of type std:tinvalid_ergunenti stois no conversion void shoppinglist (const vector shoppinglistkodlarz; vector shoppinglistadetier; cout "Enter Shopping List (QR, Quantity) or 'END' to finish:In"1 whilo (true) t getline(cin, 1ine); if (fine = "END") break; r int amounta sto (1 ine, substr (iine, find (' ' )+1) ); int indox = findercodoIndox(qreodes, qreode); if (index t=1 ) t shoppingliatkodlar, push_back(qreodo); shoppinglistadotler,push_bsok(amount); ) else t cout "Invelid QR codo. Please onter a valid CR code. In"; 3 ) double subtotal =0.0; cout \& fixed; cout "Iten Name * Quantity Total Pxicela"; for (size_t 1=0;1 to use setw. Note that you should \#include to use setw. Setting Decimal Precision for Prices: - To ensure that all prices are displayed with two decimal places, use 'fixed' and 'setprecision(2)'. - Place cout
can you fix my code
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