Extremely new

Write your question here.

  cout <<"Hello World" ;

I just downloaded the Visual studios express 2013 and am attempting C++. I've tried this in other compilers and it has worked. When you start a new project it seems the starting lines always look different and it's showing

int _tmain(int argc, _TCHAR* argv[])

I thought you just needed int() ? What is all that stuff in between all about?

It's telling me that cout is undefined? Plz help lol thanks
Replace "cout" with "std::cout". That, or above main, write "using namespace std;" Now, the former of the two options is more ideal, but the latter is easier to manage for people newer to coding.
Now it's telling me with the "std" "a namespace name is not allowed"

This worked... don't know why the namespace name was not allowed though


#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
cout << "Hello World!";
return 0;

Last edited on
The stuff inside the parentheses allows the main function to be 'fed' information and to act on it. This is called 'passing' an argument. You won't experience this much in Visual Studios, but in a Linux command line, you will often type in a command followed by the name of the file you want that command to act on. The stuff in the parentheses is what allows the program to refer to an manipulate the additional information.

This is just a way to give a program information to act on as soon as it starts running. The variable argc is just a count of the 'arguments' that are being 'passed' so the program knows how many it will be looking through so it doesn't miss any, and _TCHAR* argv[] is a list of the arguments that you're actually passing.

The 'stuff in between,' as you've put it, can largely be ignored for now. Leaving it in won't do any harm, nor should taking it out.
Thx for the help guys I really appreciate it. This will help me get started for the long road ahead.
Topic archived. No new replies allowed.