I'm new to c++ and I'm trying to make a chess game.
Here's the thing I'm trying to make the main menu, and am having trouble. here's the snippit of my code:
int mMenu(int&, char&, bool&, char&);
int main(char&)
{
int choice;
char sure;
bool quit = false;
char ctrl // used for the control from main menu to main()
mMenu (choice, sure, quit);
do
{
if (ctrl == a)
NewGame();
else if (ctrl == b)
LoadGame();
else
quit = true;
}
while (quit == true);
return 0;
}
int mMenu(int& choice, char& sure, bool& quit, char& ctrl,)
{
do
{
cout << " Chess "
<< "------------------------ Main Menu ------------------------\n"
<< "Please choose what operation you'd like to perform from the menu below\n\n"
<< "1. New Game.\n"
<< "2. Load Game.\n"
<< "Exit.\n"
<< "Your choice: ";
cin >> choice;
if (choice == 1)
{
cout << "Are you sure you wish to start a new game? (Y/N) ";
cin >> sure;
if (sure != 'Y')
clrscr();
else
{
ctrl = a;
quit = true;
}
else if (choice == 2)
{
ctrl = b;
quit = true;
}
else if (choice == 3)
{
cout << "Are you sure you wish to exit? (Y/N) ";
cin >> sure;
if (sure != 'Y')
clrscr();
else
{
quit = true;
ctrl = c;
}
}
}
}
while (quit = true);
return ctrl;
}
From that code my compiler (visual c++) is saying that int the main() function, mMenu does not take 3 arguments. What is wrong and how do I make it work?
Thanks in advance.
Also as you can see I'm trying to use clrscr(); but the compiler is flagging it saying it cannot find the definition for it, despite putting in the #include any ideas?