using namespace std

I am new here, still having problems to try programs with using namespace std. already went through the provided notes, but still not having fully grasp of the namespace. Can anyone explain to me why is that happening?
note: I am using the Turbo C++ 4.5.
Thanx
//unsuccessful program
#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World!";
return 0;
}
//successful program
#include<iostream.h>
main()
{
cout<<"Hello World!";
return 0;
}
Last edited on
The first version is correct C++. The other is not.

I don't know anything about "Turbo C++ 4.5", but maybe you should look for something better.

BTW: What error message did you get?
closed account (z05DSL3A)
I remember "Turbo C++ 4.5" it was released about 1994. As I remember it did not use namespaces. As ropez said, you would be better off getting a newer compiler.
Turbo doesnt compile using std;
A good free compiler is Dev-C++;
its free good luck program looks good though
You could also try Microsoft's Visual C++ Express 2008.
Yeah, I think maybe it's the compiler problem. Without the namespace, the second program works. I have been using the compiler since my undergrads, because the lecturer been using that one. So far, I find no difficulty in using that compiler, until when this namespace problem appeared. I guess I will try to use the other compiler like the one suggested by yogurt n try to compare it with Turbo C++.
Anyway, thanx guys!
I tried to run the same program using other free editor, Crimson Editor. The program works! So I guess namespace just doesnt work in Turbo C++.
Thanx guys!
Topic archived. No new replies allowed.