Question
//PLEASE HELP ME REMOVE THE ERROR FROM THIS PROGRAM USING C++] #include #include #include #include using namespace std; const int NUM_DEVICES = 10; const int
//PLEASE HELP ME REMOVE THE ERROR FROM THIS PROGRAM USING C++]
#include
using namespace std;
const int NUM_DEVICES = 10; const int price = 12000 ;
struct devicedata { string device_name; float price[price]; char total_price_per_purchase; string devicedata; };
void Program_Description(); void get_devices(); void read_device_data(ifstream&, devicedata[]); void write_device_data(); void read_device_prices(devicedata[]); void calculate_total_expenses(devicedata[]); void disp_table(ofstream&, int, string, double);
int main() { int choice; string deviceName; string fileName; float total_price; ofstream outFile; ifstream inFile; devicedata prices[NUM_DEVICES]; Program_Description();
do { cout << "Option to choose from "<
if(choice == 1) { cout << "Enter the file name"< writedeviceData(outFile, prices); outFile.close(); } else if(choice == 7) { displayData(prices); } else if (choice == 8) { cout<<"Finish"< } else { cout << "Invalid number entered"< return 0; } void get_data(double& electrical, double& electronic) { for(int i = 0; i < 5; i++) { cout << "Enter device code" << i+1 << ":"; cout << "electrical" < cout << endl << endl; } void read_device() { getline(fin, device); } void read_device_prices(double&) { string device; fin>>device; fin>>prices; } void calculate_total_price() { int totalexp, qty, price, discount; cout<<"Enter total quantity:"; cin>>qty; cout<<"Enter total price:"; cin>>price; totalexp=qty*price; if(totalexp>5000) { discount=(totalexp*0.1); totalexp=totalexp-discount; } cout<<"Total Expense is RM. "< } void disp_table(ofstream& fout, int loop, string device, double prices) { fout< //******************************************// //PLEASE HELP ME REMOVE THE ERROR FROM THIS PROGRAM USING C++ // thanks in advance.
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