I have a namespace problem (I just started C++)

In the following mini-code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

// Why don't the following two lines work?:
//using namespace std::cout;
//using namespace std::endl;

using namespace std; // the above two lines are not sufficient when this line is commented out

int main()
{

    cout << "Hello.";
    cout << endl;
    cout << "world!" << endl;
    return 0;
}


Why aren't those two lines sufficient after comming "using namespace std" without the quotes?

Any input would be greatly appreciated!
Thanks in advance!
That's because std::cout and std::endl aren't namespaces. Chuck the namespaces in front of the first two usings and you should be just fine. :)

-Albatross
Thanks!
Topic archived. No new replies allowed.