News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

making a working .exe than i can send to other people

Started by seventhmoon, February 06, 2006, 09:09:48 PM

Previous topic - Next topic

seventhmoon

I'm new to C++. I've just made my first Hello World application, and I've run it and it runs fine. I was wondering  how I can 'Publish' a working .exe that I can send to other people (just an example). There is a exe in my project folder but when i click on it it pops up very fast and the closes.


sethjackson

Add this before return 0;

Code (cpp) Select

std::cout << std::endl << "Press Enter to exit.";

std::cin.get();

thomas

To publish a program, you can upload it to a web server or ftp server.

To prevent your program from closing (which is perfectly normal, by the way), you can for example wait for keyboard input. Look at the C/C++ new project template to learn how that is done (or look at a "learning C" tutorial.

Please do note that there are forums and collections of frequently asked questions dedicated to general C++ questions such as these (googling for C++ faq may help). We are a Code::Blocks forum.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

sethjackson

Quote from: thomas on February 06, 2006, 09:40:46 PM
To prevent your program from closing (which is perfectly normal, by the way), you can for example wait for keyboard input. Look at the C/C++ new project template to learn how that is done (or look at a "learning C" tutorial.

Maybe that should be a "learning C++" tutorial.  :lol:

Yeah I just told him how to wait for input. std::cin.get() :) Although it only waits for a carrige return IIRC.

Some tuts

http://www.cprogramming.com/tutorial/lesson1.html
http://cplusplus.com/doc/tutorial/

And a nice C\C++ reference (The STL reference helps me alot).

http://www.cppreference.com/index.html

seventhmoon

Quote from: sethjackson on February 06, 2006, 09:39:32 PM
Add this before return 0;

Code (cpp) Select

std::cout << std::endl << "Press Enter to exit.";

std::cin.get();


Od.. Even after i added that it still does it.

sethjackson

Are you making a console program or a GUI program????

Post you full code here if you can please. :)

Vampyre_Dark

system("PAUSE"); will work too, but it's ugly.

Don't let that stop you from using it until you become more proficient in C++ though.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~