'std' : illegal use of namespace identifier

Hi There,

I'm just learning C++ so am learning about input/output and trying to figure out what's wrong below.

I am getting to following errors in Visual C++ 2008 and my code (found below) will not run. Can anyone tell me why I'm getting the following errors and possibly a solution to repair the issue?

I tried including namespace std under iostream and it still gives me the error for the use of std in the last line. How is that an illegal use of the namespace identifier? Also, I have used ";" at the end of every line yet it is telling me it's missing? wth?

They all appear on line 8.
error C2882: 'std' : illegal use of namespace identifier in expression
error C2143: syntax error : missing ';' before ':'
error C2143: syntax error : missing ';' before ':'

Here is my code:


#include <iostream>

int main()
{
std::cout<< "What is your favorite number?" << std::endl;
int iNumber;
std::cin >> iNumber;
std::cout << "Your favorite number is" << iNumber << std:endl;
return 0;
}


Can anyone help?
std::cout << "Your favorite number is" << iNumber << std:endl;

Your missing a colon for std:endl;
Topic archived. No new replies allowed.