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 #include #include #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 "<> choice;

if(choice == 1) { cout << "Enter the file name"<> fileName; inFile.open(fileName.c_str()); if(inFile.fail()) { cout<<" error"<> prices[i].deviceName; cout <<"Enter the device price"<> prices[i].price[j]; } } calculate_total_prices(prices); } else if(choice == 3) { sortAscending(prices); } else if(choice == 4) { calculate_total_prices(prices); } else if(choice == 5) { cout<<"Enter the device that you're looking for"<> devicename; int i =0; bool found = false; while ((!found)&&(i<=NUM_DEVICES)) { if(devicename == price[i].devicename) { found = true; } else i++; } cout<< "No Device Price"<

writedeviceData(outFile, prices); outFile.close(); } else if(choice == 7) { displayData(prices); } else if (choice == 8) { cout<<"Finish"<

} else { cout << "Invalid number entered"<= 1) && (choice < 8)); inFile.close();

return 0; }

void get_data(double& electrical, double& electronic) { for(int i = 0; i < 5; i++) { cout << "Enter device code" << i+1 << ":"; cout << "electrical" <> electrical; } for(int i = 0; i < 5; i++) { cout << "Enter device code" << i+1 << ":"; cout << "electronic" <> electronic; cin.ignore(); }

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!