I am trying to execute the below addition of two numbers C++ Program using Dev C++ IDE.. and am not getting the output.
As I looked into the code there seems to be no problem. Please help me.
What happens is when I enter two numbers in the command prompt after the execution of program I dont get output and it just disappears without any output.
//program to add two numbers
using namespace std;
cout<<"Enter two numbers"<<endl;
cout<<"Sum of two numbers are"<<c;
I think you can add
system("pause"); after the
Yes, it is working
Thanks a lot
But why like that it happens?
Pause will hold cmd prompt till we press an enter.
Am I right?
Yes, it will ask the system to pause first before it closes :)
|But why like that it happens?|
Pause will hold cmd prompt till we press an enter
system() throws commands at the command prompt or terminal,
just like you can (in windows)mkdir, cls, cd, del, dir....(or in linux)mkdir,clear,cd,rm,pwd,ls..etc
, you can use system() to do this within a program..
in windows, open up your cmd prompt and type "pause"
and you should understand better why system("pause") does what it does..
(i think pause is used for batch scripting, but i don't really know...)
Last edited on