this is my complete do while condition
Code:
char menu;
do {
printf("MAIN MENU\n");
printf("[d] Display Empty Chess Board\n");
printf("[v] Check Validiti of Chess Notation\n");
printf("[s] Save Moves to e Text File\n");
printf("[e] End program\n");
printf("Selection [d, v, s, f, e]: ");
scanf("%c\n", &menu);
if (menu != 'e')
{
switch(menu)
{
case 'd':
display_board();
break;
case 'v':
check_move();
break;
case 's':
save_move();
break;
default:
printf("wrong character. Print menu again\n\n");
break;
} // switch
} // if
} while(menu != 'e');
Now with scanf() thats what I get in the console the first time it executes:
MAIN MENU
[d] Display Empty Chess Board
[v] Check Validiti of Chess Notation
[s] Save Moves to e Text File
[e] End program
Selection [d, v, s, f, e]: d
d
Notice that I type "d - Enter - d" before the switch statement executes.
then display_board() runs and the menu is printed again. Not only that but when I give 'v' after that, display_board() executes again and not the check_move() funtion