Error Pembuatan program Inventory,bisa dipecahkan?

#include #include #include using namespace std;

struct itemEntry { float unit_price; int copies,product_id; char name[30]; char company[30]; };

class Store { public: int numItem; itemEntry database[100];

Store() { numItem=0; } void insertItem(char itemName[],char company[],int pid,int c,float p); void deleteItem(char itemName[],int pid); itemEntry *searchi(char itemName[],int pid); void updateItem(char itemName[],int pid,int total,float price); };

void Store::insertItem()(char itemName[],char company[],int pid,int c,float p) { strcpy(database[numItem].name,itemName); strcpy(database[numItem].company,company); database[numItem].product_id=pid; database[numItem].copies=c; database[numItem].unit_price=p; cout<<"\n\t\t\t ITEM INERTED SUCCESFULLY"; numItem++; } void Store::deleteItem(char itemName[],int pid) { int i; for(i=0;icopies+=total; item->unit_price=price; }

int main() { Store sto; char name[30],company[30]; int product_id,copies,unit_price,option; do { cout<<"\n\t\t\t -------------TOKO ASU---------------"; cout<<"\n\t\t\t --------------MENU-----------------------"; cout<<"\n\t\t\t 1. for insert "; cout<<"\n\t\t\t 2. for delete "; cout<<"\n\t\t\t 3. for search "; cout<<"\n\t\t\t 4. for update "; cout<<"\n\t\t\t 5. for exit "; cout<<"\n\t\t\t enter your choice "; cin>>option; switch(option) { case 1 :cin.getline(name,80); cout<<"\n\t\t\t enter name item = "; cin.getline(name,80); cout<<"\n\t\t\t company = "; cin.getline(company,80); cout<<"\n\t\t\t enter product ID = "; cin>>product_id; cout<<"\n\t\t\t No of copies = "; cin>>copies; cout<<"\n\t\t\t price per item = "; cin>>unit_price; sto.insertItem(name,company,product_id,copies,unit_price); break; case 2 :cin.getline(name,80); cout<<"\n\t\t\t enter name item = "; cin.getline(name,80); cout<<"\n\t\t\t enter product ID = "; cin>>product_id; sto.deleteItem(name,product_id); break; case 3 :cin.getline(name,80); cout<<"\n\t\t\t enter name item = "; cin.getline(name,80); cout<<"\n\t\t\t enter product ID = "; cin>>product_id; itemEntry *test; test=sto.searchi(name,product_id); if(test!=NULL) { cout<<"\n\t ------- Searching result ------ "; cout<<"\n\t Item found"<<"\n\t\t Name of time : "<name<<"\n\t\t company name = "<company<<"\n\t\t product id"<product_id<<"number copies of available = "<copies<<"\n\t\t\t unit price per item = "<unit_price; } else cout<<"Item not found"; break; case 4 :cout<<"\n\t\t enter detail for update"; cin.getline(name,80); cout<<"\n\t\t enter detail = "; cin.getline(name,80); cout<<"\n\t\t enter product id = "; cin>>product_id; cout<<"enter total new entry = "; cin>>copies; cout<<"\n\t\t ENter new price = "; cin>>unit_price; sto.updateItem(name,product_id,copies,unit_price); break; } }while(option!=5); return 0; }

avatar borisboo
@borisboo

2 Kontribusi 0 Poin

Diperbarui 7 tahun yang lalu

1 Jawaban:

Jawaban Terpilih

sudah terjawab

avatar borisboo
@borisboo

2 Kontribusi 0 Poin

Dipost 7 tahun yang lalu

Login untuk ikut Jawaban