C++ Help.I am beginner?

When i entered This way to obtain code in Dev — C++………..

// my source code

#include
employing namespace a sexually transmitted disease;

int key ()

int post;
cout << "Please type in an integer price:";
cin >> post;
cout << "The value you entered is " << my spouse and i;
cout << " in addition to its twice is " << i*2 << ".\n";
returning 0;

only insert 702 seeing that integer, it need to show the following……

Please enter an integer benefit:702
The worthiness you entered is 702 as well as its twice is 1404.

Nonetheless it first shows

Please enter an integer benefit:

then i include 702 and press key in.after doing this programs end without showing double.Pondered tried various other sources, also.But We have similar issue with many.

I am using Dev — C++ FOUR.9.9.2.in addition to I authored the form code throughout source file.
Remorseful, For not necessarily good British.

This will do

#include
employing namespace a sexually transmitted disease;

int key ()

int post;
cout << "Please type in an integer price:";
cin >> post;
cout << "The value you entered is " << my spouse and i;
cout << " in addition to its twice is " << i*2 << ".\n";
a sexually transmitted disease::cin.get();
returning 0;

Many thanks, Hope that helps

Place a new system(“pause”) after cout << " as well as its twice is " << i*2 << ".\n";

Without a thing to pause this program, it will tell you the program then immediately end this software with a new return price of 0.Adding the particular system(“pause”) ought of do it.

Add that line before the return 0;

system(“PAUSE”);

This program is performing the calculation, but it is closing the screen before you will observe it.That line will temporarily halt the output in order to view that.

Leave a Reply