#include %26lt;iostream%26gt;
using namespace std;
int main ()
{
int a, b, result;
cout%26lt;%26lt;"Enter a number: ";
cin%26gt;%26gt; a;
cout%26lt;%26lt;"Enter another number: ";
cin%26gt;%26gt; b;
result = a + b;
cout%26lt;%26lt; result;
}
what is the problem with my code it closes after i hit enter on the second cout.
C++ help!!!?
hi
surely u r using awindev or an other c++ editor for that add : getch(); in the end of program to stop execution to see result.
with visual c++ u have not to add it.
bye for now
Reply:add header
conio
use getch before closing braces of main
Reply:Isn't enter as in space %26lt;br%26gt; It is for html but I know you're doing c++.
Reply:Your code is perfect. It closes because it's finished.
Add something to make it wait. Maybe you can tell the user "press any key to exit" then cin %26gt;%26gt; once more.
flower girl dresses
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment