i'm trying to learn to write programs. i have gotten borland c++ 5.02 to use as a compiler, and i figured that the "hello world" program was a good place to start. i printed it exactly as it did in the cplusplus.com tutorial, but for some reason, it kicks back a compiling error. it says "namespace name expected" after the word namespace
1 2 3 4 5 6 7 8
#include <iostream>
usingnamespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
btw, i the std::cout statement didn't work, it kicked back errors, bu i tried taking out the using namespace line all together, and i'm not sure if it worked or not. a dosbox pops up and it looks like code or execution text flashes accross the screen for a fraction of a second before the box disappears again. it might have worked, but just not stayed long enough for me to read it?
The underlined part is added to tell Windows to pause before closing the console window. Add that just before the "return" command, and you will be able to see the results. I think that will work for any program.
By the way, I use the Borland Turbo C++ myself, and have no problems yet. If the experienced programmers out there don't like it, tell me what free one to use.
The greatest problem with using system("pause") is the massive security hole it puts in your program. All other problems being equal: it is a waste of time and energy.
duaos, i read one of the links and the code worked to 'pause' the dosbox till i pressed enter, as i expected it would, but what does each part of the code mean? (sry, i'm a sucker for mechanics and syntax...) cin.ignore( numeric_limits<streamsize>::max(), '\n' );