Menu works?

This commit is contained in:
Matti 2024-11-22 15:19:33 +01:00
parent 68e7176d2e
commit 2e4efa7833
2 changed files with 31 additions and 25 deletions

View File

@ -9,11 +9,11 @@
class MenuManager { class MenuManager {
private: private:
int* currentMenu; int * currentMenu;
std::string* selectedMetric; std::string * selectedMetric;
std::string* selectedRegion; std::string * selectedRegion;
public: public:
MenuManager(int* currentMenu, std::string* selectedMetric, std::string* selectedRegion){ MenuManager(int * currentMenu, std::string * selectedMetric, std::string * selectedRegion){
this->currentMenu = currentMenu; this->currentMenu = currentMenu;
this->selectedRegion = selectedRegion; this->selectedRegion = selectedRegion;
this->selectedMetric = selectedMetric; this->selectedMetric = selectedMetric;

View File

@ -53,30 +53,36 @@ void Aufg8Main() {
std::cout << "==============" << std::endl; std::cout << "==============" << std::endl;
} }
deleteAllPointers(allSales); std::string selectedRegion;
std::string selectedType;
int currentMenu = 0;
std::string* selectedRegion; std::string* PselectedRegion = &selectedRegion;
std::string* selectedType; std::string* PselectedType = &selectedType;
int* currentMenu; int* PcurrentMenu = &currentMenu;
MenuManager menu{currentMenu, selectedRegion, selectedType}; MenuManager menu{PcurrentMenu, PselectedRegion, PselectedType};
menu.MainInteraction(); menu.MainInteraction();
switch (*currentMenu) { // TODO Finish these while (currentMenu) {
case 0: std::cout << "Deciding if youre allowed to quit" << (currentMenu) << std::endl;
return; switch (currentMenu) { // TODO Finish these
case 1: case 0:
// getTotalProfitFor(*selectedType); return;
case 1:
// getTotalProfitFor(*selectedType);
break;
case 2:
// getSaleCount(*selectedType, *selectedRegion);
break;
case 3:
getMostPopularTypeIn(selectedRegion, allSales);
break; break;
case 2: case 4:
// getSaleCount(*selectedType, *selectedRegion); // getOnlineVsOfflineIn(*selectedRegion);
break; break;
case 3: default:
getMostPopularTypeIn(*selectedRegion, allSales); std::cout << "You should not be able to reach this!";
break; }
case 4: menu.MainInteraction();
// getOnlineVsOfflineIn(*selectedRegion);
break;
default:
std::cout << "You should not be able to reach this!";
} }
} }