cout help

Hi, its been a long time since I've done any programing.

Here's my problem, I can't get cout to work even in this simple test program. Using microsoft visual C++ 2008.

#include <iostream>
using namespace std;
cout << "TEST";


I get two errors.
-syntax error: missing ';' before '<<'
-missing type specifier - int assumed.


I tried using iostream.h but in that case I get an error saying file does not exist. Nearest I can figure is the program is tying to use cout as a variable.
You need to put it all into a main function:

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
using namespace std;




int main() {

cout << "TEST" << endl;

return 0;
}


The main function is where the program starts.

I think you need to do some tutorials:

http://www.cplusplus.com/doc/


There is a lot of documentation and reference on this site.

Hope all goes well.

Edit: Changed what I said about namespace std

Last edited on
(facepalm) I can't believe I forgot main. Thanks. It has been a really long time since I've done this.
Topic archived. No new replies allowed.