Trying to exit my program after a "while"

I'm writing a sudoku game and my only problem right now is that I can't get it to terminate the program after the board is saved.

Any ideas or suggestions?

Thanks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
void askMenu(char menu, char board[][9])
{
  bool poss[9];
  char coordinate[2];
  int indexCoordinate[2];
  
   cout << "> ";
   cin >> menu;
    
  switch (menu)
   {
      case '?':
         showInstructions();
         cout << '\n';
         break;
      case 'D':
      case 'd':
         displayBoard(board);
         break;
      case 'E': // edit one square
      case 'e':
         editSquare(board);
         break;
      case 'S': // possible values
      case 's':
	promptSquare(coordinate);
	convertCoordinate(coordinate, indexCoordinate);
	computePossible(board, indexCoordinate, poss);
	showPossibleValues(poss, coordinate);
	break;
      case 'Q':
      case 'q':
         saveAndQuit(board);
         break;
      default:
         cout << "ERROR: Invalid command\n";
   }
}

int main()
{
 char board[9][9];
   char menu;

   while (menu != 'Q') 
   askMenu(menu, board);
   return 0;
}
Pass menu by reference.
http://www.cplusplus.com/doc/tutorial/functions/
 
void askMenu(char& menu, char board[][9])
thanks
Topic archived. No new replies allowed.