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
#include<iostream>
using namespace std;
main()
{
int a,b,c;
cout<<"Enter two numbers"<<endl;
cin>>a>>b;
c=a+b;
cout<<"Sum of two numbers are"<<c;
cout<<c<<endl;
}
But why like that it happens?
Pause will hold cmd prompt till we press an enter
about system("pause");
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...)