Why does switch always run default? (with break; included)
问题 C++ newbie trying to make a simple text game on a 2D array. When I use the switch statement as shown. It will always print the default value, regardless of what else happens. From other threads and forums I found it probably has something to do with the getch() and that it returns the char as well as \n . I have tried for an hour now but I can not solve this. The reason I use getch() is this: C++ change canonical mode in windows (for reference). Part of my code now: //Set up game field