Witam, może od razu przejdę do rzeczy, zrobiłem sobie osobną biblioteke do mojego programu gdzie zawieram wszystkie swoje funkcje i mam problem z jedną rzeczą otóż:
int menu(int a){
while((a>5) || (a<1)){
cout << "________________________________" << endl;
cout << "||====== MENU APLIKACJI ======||" << endl;
cout << "________________________________" << endl;
cout << "|| ||" << endl;
cout << "|| 1. Zgadnij liczbe ||" << endl;
cout << "|| 2. Gra Matematyczna ||" << endl;
cout << "|| 3. Wisielec ||" << endl;
cout << "|| 4. Kalkulator ||" << endl;
cout << "|| 5. Wyjscie ||" << endl;
cout << "________________________________" << endl;
cout << "|| Wybierz aplikacje (1-4) ||" << endl;
cout << "________________________________" << endl;
cout << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" << endl;
cout << "==========>> ";
cin >> a;
system("cls");
if((a>5) || (a<1))
{
cout << "________________________________" << endl;
cout << "||======== INFORMACJA ========||" << endl;
cout << "________________________________" << endl;
cout << "|| ||" << endl;
cout << "|| Aplikacja o podanym ||" << endl;
cout << "|| numerze nie istnieje. ||" << endl;
cout << "|| Prosze podac numer ||" << endl;
cout << "|| z zakresu od 1 do 5. ||" << endl;
cout << "________________________________" << endl;
Sleep(3000);
system("cls");
}
return a;
}
}
To jest funkcja, która ma mi zwrócić wartość w zmiennej a do funkcji main, a nie moge jej wyciągnąć, wiem że musze zrobić albo wskaźnik albo referencje do tego ale nie wiem zbytnio jak, prosze o pomoc, dodaje jeszcze całego int maina
#include <iostream>
#include <windows.h>
#include <ctime>
#include "aplikacjegierka.h"
#include <stdio.h>
using namespace std;
int main()
{
int a;
menu(a);
cout <<a;
getchar();
switch(a)
{
case 1:
cout << "Wypisuje program 1"<<endl;
zgadnijliczbe();
break;
case 2:
cout << "Wypisuje program 2"<<endl;
break;
case 3:
cout << "Wypisuje program 3"<<endl;
break;
case 4:
cout << "Wypisuje program 4"<<endl;
break;
case 5:
system("quit");
break;
}
return 0;
}