I have been working with simple graphics programs using graphics.h, and I noticed a problem while using it. When I run the program, it opens the graphics window and the text input and output window. I tried to make a simple menu system in the text window, and I would use scanf to determine if the graphics window started, or Instructions opened in the text window. I ran the program and it crashed almost immediately. I determined that scanf was causing it to crash by eliminating other things from my program.

After this I tried putting the if statement that used the variable I used in the scanf statement for the menu in different parts of the program, trying to make it not crash. Nothing worked, so it seems to be scanf crashing it. Does anybody have a solution to not make the program crash/alternative menu options?