Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- // ADD Code for displaying a welcome Menu
- // and handle all required logic to add, search, update, and delete product
- SearchProduct searchProduct;
- ProductManager pManager;
- int choice = 0;
- while (choice != 7)
- {
- choice = pManager.getMenu();
- switch (choice)
- {
- case 1:
- {
- pManager.addProduct();
- break;
- }
- case 2:
- {
- cout << "Enter name to search for" << endl;
- string name;
- cin >> name;
- vector<Product> results = searchProduct.searchByName(name);
- searchProduct.showSearchResult(results, name);
- break;
- }
- case 3:
- {
- cout << "Enter category to search for" << endl;
- string category;
- cin >> category;
- vector<Product> results = searchProduct.searchByCategory(category);
- searchProduct.showSearchResult(results, category);
- break;
- }
- case 4:
- {
- cout << "Enter brand to search for" << endl;
- string brand;
- cin >> brand;
- vector<Product> results = searchProduct.searchByBrand(brand);
- searchProduct.showSearchResult(results, brand);
- break;
- }
- case 5:
- {
- cout << "Enter product code" << endl;
- string prodCode;
- cin >> prodCode;
- pManager.updateProduct(prodCode);
- break;
- }
- case 6:
- {
- cout << "Enter product code" << endl;
- string prodCode;
- cin >> prodCode;
- pManager.deleteProduct(prodCode);
- break;
- }
- case 7:
- exit(0);
- break;
- default:
- break;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment