Hi folks, reading a book on C programming, a modern approach and working through the examples. So far so good, best book on C I have ever read!
One problem I am having with some of my programs is that they behave differently outside of the IDE. I am using codeblocks, but when I save my program and use it as a stand alone .exe the program doesn't behave the same. What usually happens is the screen under the standalone version will disappear after I hit enter. On some programs, the simpler ones, I was able to circumvent by adding another getchar(); statement right after the first at the end of the program. My guess was the '\n' inside of the printf statement was triggering the getchar to activate. In this next program that is more complex, the same issue was occurring in the windows box vs. the IDE. I even added a series of getchar statements, but it didn't work.
The program takes an input of a certain dollar amount and breaks it down into the highest denominations of US currency and outputs how many of each bill is required. In the IDE it works flawlessly, producing expected results with a pause at the end to see your work.


As a standalone .exe under windows, after entering the value and hitting enter, the screen disappears. I assume that this is not a programming issue, but an interface issue. Is there a way to pause the screen to view the work? As a standalone program, I would expect the output to stay and wait for a prompt before shutting down!
Thanks in advance.
One problem I am having with some of my programs is that they behave differently outside of the IDE. I am using codeblocks, but when I save my program and use it as a stand alone .exe the program doesn't behave the same. What usually happens is the screen under the standalone version will disappear after I hit enter. On some programs, the simpler ones, I was able to circumvent by adding another getchar(); statement right after the first at the end of the program. My guess was the '\n' inside of the printf statement was triggering the getchar to activate. In this next program that is more complex, the same issue was occurring in the windows box vs. the IDE. I even added a series of getchar statements, but it didn't work.
The program takes an input of a certain dollar amount and breaks it down into the highest denominations of US currency and outputs how many of each bill is required. In the IDE it works flawlessly, producing expected results with a pause at the end to see your work.


As a standalone .exe under windows, after entering the value and hitting enter, the screen disappears. I assume that this is not a programming issue, but an interface issue. Is there a way to pause the screen to view the work? As a standalone program, I would expect the output to stay and wait for a prompt before shutting down!
Thanks in advance.