------CMenu.cpp----- #include "CMenu.h" CMenu::CMenu() { licznikOpcji = 0; } CMenu::~CMenu() { cout << "\nbye bye"; } void CMenu::wyswietl() { for (int i = 0; i < this->licznikOpcji; i++) { cout << i + 1 << ". " << this->opcje[i] << endl; } cout << "\nPodaj Wybor:"; int wybor; cin >> wybor; if (wybor > 0 && wybor <= this->licznikOpcji) { cout << "Wybrales: " << this->opcje[wybor - 1]; this->funkcje[wybor - 1]; } //cout << "#smierc"; } void CMenu::dodajOpcje(char *nazwa, void funkcja()) { strcpy_s(this->opcje[this->licznikOpcji], 30, nazwa); this->licznikOpcji++; } ------CMenu.h------ #pragma once #include using namespace std; class CMenu{ char opcje[10][30]; void(*funkcje[10])(void); int licznikOpcji; public: CMenu(); void dodajOpcje(char *nazwa, void *funkcja()); void wyswietl(); ~CMenu(); }; ------program.cpp--------- #include "CMenu.h" #include #include using namespace std; void test() { cout << "funkcja test" << endl; } void test2() { cout << "funkcja test2" << endl; } void test3() { cout << "funkcja test3" << endl; } int main() { //test(); CMenu Menu; Menu.dodajOpcje("opcja pierwsza", &test); Menu.dodajOpcje("opcja druga", &test2); Menu.dodajOpcje("opcja trzecia", &test3); Menu.wyswietl(); system("pause>nul"); return 0; } #nie dziaƂa