Need some help

I'm completely new to programming, and I'm using a book called 'Accelerated C++' by Andrew Koenig and Barbara E.Moo.
I'm trying to make the program Hello World!, but I'm not successful.
I'm using Microsoft C++ 2010 Express.
This is the exact code I used.

1
2
3
4
5
6
7
8
  // my attempts at making a C++ program
#include <iostream>

int main()
{
    std: :cout << "Hello, world!" << std::endl;
    return 0;
}


I get a red underline beneath the ':' right next to 'cout'. When I pan my cursor over it, it says 'Error: expected an expression'
When I try and run it it says there were build errors, and if I try and run it anyway it states 'The system cannot find the file specified.'
Also in the small box beneath all the code, there is this

1>------ Build started: Project: Hello World! 2, Configuration: Debug Win32 ------
1> Hello World.cpp
1>c:\users\mycom\documents\visual studio 2010\projects\hello world! 2\hello world! 2\hello world.cpp(6): error C2143: syntax error : missing ';' before ':'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Remove blank between two semicolons

std: :cout

The compiler consideres

std:

as a label because it is followed by space.
Last edited on
vlad from moscow wrote:
semicolons
I hope you mean colons.
Semicolon = ;. Colon = :.
You could cout<<"whatever you need to say"; correct my if im wrong or you are doing it a different way.
He's doing it the faster way not including every std namespace but instead the ones he is actually using
Last edited on
Registered users can post here. Sign in or register to post.