Question: Please help fix the error. I used C++ #include #include #include #include #include using namespace std; class product { int product_number; char product_name[150]; float product_price,product_quantity,tax,product_discount;

Please help fix the error. I used C++

#include #include #include #include #include

using namespace std;

class product { int product_number; char product_name[150]; float product_price,product_quantity,tax,product_discount; public:

void generate_product() { cout>product_number; cout>product_price; cout>product_discount; } void display_product() { cout

fstream fp; product produc;

void store_product() { fp.open("storedatabase.dat",ios::out|ios::app); produc.generate_product(); fp.write((char*)&produc,sizeof(product)); fp.close(); cout

void display_all_product() { system("cls"); cout

void display_record(int num) { bool found=false; fp.open("storedatabase.dat",ios::in); while(fp.read((char*)&produc,sizeof(product))) { if(produc.getProduct()==num) { system("cls"); produc.display_product(); found=true; } } fp.close(); if(found == true) cout

void edit_product() { int num; bool found=false; system("cls"); cout>num; fp.open("storedatabase.dat",ios::in|ios::out); while(fp.read((char*)&produc,sizeof(product)) && found==false) { if(produc.getProduct()==num) { produc.display_product(); cout int pos=-1*sizeof(product)); fp.seekp(pos,ios::cur); fp.write((char*)&produc,sizeof(product)); cout

void delete_product() { int num; system("cls"); cout>num; fp.open("storedatabase.dat",ios::in|ios::out); fstream fp2; fp2.open("Temp.dat",ios::out); fp.seekg(0,ios::beg); while(fp.read((char*)&produc,sizeof(product))) { if(produc.getProduct()!=num) { fp2.write((char*)&produc,sizeof(product)); } } fp2.close(); fp.close(); remove("storedatabase.dat"); rename("Temp.dat","storedatabase.dat"); cout

void product_menu() { system("cls"); fp.open("storedatabase.dat",ios::in);

cout

void place_order() { int order_arr[150],quan[150],c=0; float amt,damt,total=0; char ch='Y'; product_menu(); cout>order_arr[c]; cout>quan[c]; c++; cout>ch; }while(ch=='y' ||ch=='Y'); cout

void admin_menu() { system("cls"); int option; cout

cout>option; switch(option) { case 1: system("cls"); store_product(); break; case 2: display_all_product(); break; case 3: int num; system("cls"); cout>num; display_record(num); break; case 4: edit_product(); break; case 5: delete_product(); break; case 6: system("cls"); break; default:admin_menu(); } }

int main(int argc, char *argv[]) { system("cls"); int option; for(;;) {

cout>option; switch(option) { case 1: system("cls"); place_order(); getchar(); break; case 2: admin_menu(); break; case 3: cout

} }

ERRORS:Please help fix the error. I used C++ #include #include #include #include#include using namespace std; class product { int product_number; char product_name[150]; float

#include #include #include #include #include using namespace std; *] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 class product { int product_number; char product_name[150]; float product_price, product_quantity, tax, product_discount; public: void generate_product() { cout>product_number; cout>num; 122 123 124 125 126 127 128 fp.open("storedatabase.dat", ios::inios::out); while(fp.read((char*)&produc, sizeof(product)) && found=false) if(produc.getProduct()==num) 129 produc.display_product(); cout

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!