diff --git a/Aufg8/MenuManager.h b/Aufg8/MenuManager.h index e6c3f36..0741b81 100644 --- a/Aufg8/MenuManager.h +++ b/Aufg8/MenuManager.h @@ -9,11 +9,11 @@ class MenuManager { private: - int* currentMenu; - std::string* selectedMetric; - std::string* selectedRegion; + int * currentMenu; + std::string * selectedMetric; + std::string * selectedRegion; public: - MenuManager(int* currentMenu, std::string* selectedMetric, std::string* selectedRegion){ + MenuManager(int * currentMenu, std::string * selectedMetric, std::string * selectedRegion){ this->currentMenu = currentMenu; this->selectedRegion = selectedRegion; this->selectedMetric = selectedMetric; diff --git a/Aufg8/SalesStatMain.cpp b/Aufg8/SalesStatMain.cpp index 9cce8e0..42cfe09 100644 --- a/Aufg8/SalesStatMain.cpp +++ b/Aufg8/SalesStatMain.cpp @@ -53,30 +53,36 @@ void Aufg8Main() { std::cout << "==============" << std::endl; } - deleteAllPointers(allSales); + std::string selectedRegion; + std::string selectedType; + int currentMenu = 0; - std::string* selectedRegion; - std::string* selectedType; - int* currentMenu; + std::string* PselectedRegion = &selectedRegion; + std::string* PselectedType = &selectedType; + int* PcurrentMenu = ¤tMenu; - MenuManager menu{currentMenu, selectedRegion, selectedType}; + MenuManager menu{PcurrentMenu, PselectedRegion, PselectedType}; menu.MainInteraction(); - switch (*currentMenu) { // TODO Finish these - case 0: - return; - case 1: - // getTotalProfitFor(*selectedType); + while (currentMenu) { + std::cout << "Deciding if youre allowed to quit" << (currentMenu) << std::endl; + switch (currentMenu) { // TODO Finish these + case 0: + return; + case 1: + // getTotalProfitFor(*selectedType); + break; + case 2: + // getSaleCount(*selectedType, *selectedRegion); + break; + case 3: + getMostPopularTypeIn(selectedRegion, allSales); break; - case 2: - // getSaleCount(*selectedType, *selectedRegion); - break; - case 3: - getMostPopularTypeIn(*selectedRegion, allSales); - break; - case 4: - // getOnlineVsOfflineIn(*selectedRegion); - break; - default: - std::cout << "You should not be able to reach this!"; + case 4: + // getOnlineVsOfflineIn(*selectedRegion); + break; + default: + std::cout << "You should not be able to reach this!"; + } + menu.MainInteraction(); } } \ No newline at end of file