Hi,

I am a new programmer - I'm taking a course of C++ programming in College.

I have a quick question - well, I hope it's quick.

After I create a program and try to run the program, the .exe file will pop up and in less than a second disappear.

This does this with ALL of the programs that I have used.

What could be causing this?

I'm currently on Windows Vista.

Thank you for your time!

Jonathan

Recommended Answers

All 5 Replies

You can add cin.get(); at the end of main before your return 0;.

I'm guessing your programs don't have any user input or any pauses. Console applications close when they are done.

Thank you, this helped much. ;)

system("pause");
return 0;
use that at the end of ur main method should work:)

system("pause");
return 0;
use that at the end of ur main method should work:)

I think using system("pause"); is not recommended.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.