Tuesday, July 14, 2009

C++ programming problem.. when i run the program it closes too soon that i cant see the output?

C++ programming problem.. when i run the program it closes too soon that i cant see the output?





pls help..


I forgot the codes so that it will not automatically close..


urgently needed assigment tomorrow...








#include %26lt;iostream%26gt;


using namespace std;





int main()


{


cout %26lt;%26lt; "the remainder of 9 divided by 4 is"%26lt;%26lt; 9%4


%26lt;%26lt; "\nThe rem of 17 div by 3 is"%26lt;%26lt; 17%3%26lt;%26lt; endl;








return 0;





}





I already know the output here but i just wnt to know what must I do for it not to close automatically..

C++ programming problem.. when i run the program it closes too soon that i cant see the output?
using this command in your last line code


getch();





This command means that the program needs anything key stroke before it continues to execute next line of code.





But, you must include a file library "conio.h"
Reply:In Visual Studio, use Ctrl+F5 to run your program (instead of just F5)
Reply:How are you launching the program? Probably by clicking on the file. If you are using Windows, bring up a command line console, start-%26gt;run enter cmd then set your directory to where you executable is at, for example: cd c:\temp\ then run your program, for example: hello.exe





Under linux/unix bring up a terminal window and cd to your directory and run your program.





Brian


No comments:

Post a Comment