3 Replies - 1682 Views - Last Post: 24 November 2010 - 12:37 AM Rate Topic: -----

#1 rodjav1991  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 24-October 10

Hello World program but cannot use using namespace std

Posted 23 November 2010 - 09:43 PM

Create a design for a program that displays the message "Hello World" and do not define it using namespace std.

How would i go about doing this. A friend and I have looked into it as why one would code this without using namespace std.
Hello world was my first C++ program and I know how to do it but i do not know how to code it without using namespace std.
Any help please?
Is This A Good Question/Topic? 0
  • +

Replies To: Hello World program but cannot use using namespace std

#2 Gorian  Icon User is offline

  • ninja DIC
  • member icon

Reputation: 120
  • View blog
  • Posts: 1,681
  • Joined: 28-June 08

Re: Hello World program but cannot use using namespace std

Posted 23 November 2010 - 09:53 PM

Well, you should try googling it (namespace std). Understand what the namespace does for you, and how the same thing can be accomplished with out using it.
Was This Post Helpful? 0
  • +
  • -

#3 Guest_joseph*


Reputation:

Re: Hello World program but cannot use using namespace std

Posted 23 November 2010 - 11:16 PM

This should work...

#include <iostream> 
using std::cout;
using std::endl;

int main()

{

	cout<<"Hello World"<<endl;
}


Was This Post Helpful? -4

#4 Gorian  Icon User is offline

  • ninja DIC
  • member icon

Reputation: 120
  • View blog
  • Posts: 1,681
  • Joined: 28-June 08

Re: Hello World program but cannot use using namespace std

Posted 24 November 2010 - 12:37 AM

That is kinda like telling someone not to use the word hi, and they use hello instead, more a smart-ass move.

Besides, don't feed him the answer, let him try to work it out. If he is really interested in learning, and doesn't figure it out, he can come back here for more help.

I googled the term "namespace std" and the first result just about gave me all I needed to figure out how to use cin and such, without using namespace std, the third result handed me the answer.

This post has been edited by Gorian: 24 November 2010 - 12:40 AM

Was This Post Helpful? 2
  • +
  • -

Page 1 of 1