Im just started doing the tutorials at cprogramming.com and in the 1st lesson, with the "Hello World" program, when execute it, the console window opens and displays "Hello World!" then quits
without any user input, how can i stop this?
Im just started doing the tutorials at cprogramming.com and in the 1st lesson, with the "Hello World" program, when execute it, the console window opens and displays "Hello World!" then quits
without any user input, how can i stop this?
I've noticed too and although I'm too much of a newbie to help. When I ran it from within MSVC++ its ok. I'm sures theres a simple way of holding that window open rather then auto closing it (which I think only win 2k and xp do)
just addCode:system("pause"); // must #include <stdlib.h> // or /* declare a variable and make the user enter something before they can quit */ int hit; cin >> hit; // must #include <iostream.h> // simply getch(); // dunno what header
getch() is <conio.h>
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
For those who may have instructors who are finicky about using standard headers, use face_master's suggestion of system("PAUSE"); with #include <cstdlib>. (I've used <conio.h> extensively in the past for getch(); and clrscr();, but...)
(I noticed a thread a day, or so, ago from a student whose teacher disallowed the use of non-standard headers. )
-Skipper
"When the only tool you own is a hammer, every problem begins to resemble a nail." Abraham Maslow
Ok thanks, ill try that when I get home, if it doesnt work or something ill post again....
And by the way, how do all you programmers find out what every .h program does?
not really
just as you come across something you need to use a new library for you learn what features it has and what it can do.
"uh uh uh, you didn't say the magic word"
-Jurassic Park
I look up a function on MSDN and figure out what header it needs... if I ever need the function again, I include the header...
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.