new to c++

sir i am new to c++
and i have tried my begining 4-5 examples on devc++ and turbo c but i have a problem with turbo c that console window closes instantly please help
theres a few ways that I know of to fix this

the first is the most simple, some IDE's (such as VC++) but in features that allow the code to halt untill you give it input at any given time. (in VC++ this is a red dot to the left of the code) if you can find that in devc++ or turbo c good on yea but im not sure either way.

the second is to insert a bit of code into your program. theres one way, using system commands, that to my knowledge is bad code to use, maybe another could elaborate on this cause im not sure.

the other way (that i know of) is c++ specific (does not work without c++ .h files) and that would be to insert these two lines into your code where you want it to stop.

1
2
cin.clear();
cin.get();


The first empties the computer of saved keystrokes in order for the second to request a keystroke before continuing. Ive had some problems with this in the past, such as cin.clear() not clearing the "buffer", but it usually works.

Hope this helps!
Last edited on
thanx frnd but it didnt helped:(
I think you're looking for this thread:

http://www.cplusplus.com/forum/beginner/1988/
Topic archived. No new replies allowed.