To prevent the terminal window from closing immediately when running directly from Visual Studio, you should add 2 getchar() statements before returning from main() to wait for user input and get a chance to see the output. ![]() If you open the terminal window yourself, by running the CMD command from the start menu, you will be able to run your program manually after changing the current directory to that of the program binary. This is a classic problem with the Microsoft Windows platform that they do not seem to care about despite millions of newbie programmers like you experiencing the same problem. When you run your console program from Visual Studio, it opens a terminal window, runs the program and the terminal window closes automatically when the program exits.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |