Every time I run my codes to show the output(using command prompt), it only shows for about half a second on the screen. I've done some research about this problem and found the code: system ("pause")
That's why I have to type it for ALL my source codes to show the result normally on the screen. My question is--Is it just my compiler(Dev-C++), or I need to configure something?
Note that with the suggested code here you will not be prompted by the consule to "Press Any Key To Continue" also you have to press "Enter" to move on unless you set the first argument to 1.
Hey firedraco Im not having triple post anymore >_>
Thanks for recommending cin.get() But I dont get why you all treat system() as evil worse. And an additional question- If both of those two have the same function and results, why is there a better one?
Ok. I find out that using system() can cause some security problems, and its pretty slow. There are trully many reasonable ideas behind using cin.get. As a beginner in C++, I'm slightly disappointed for using system() for almost 3 days, thats why I decided to use a better one.
But then again, as is explained in the stickied thread here in the beginner forums, there is usually no harm in using it when just learning to program, without releasing the code you're writing. But still, it's good practice to find other ways than system().