Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.net stuff hello world program

Status
Not open for further replies.

drewdaman

Programmer
Aug 5, 2003
302
CA
hello all.. i'm used to msvs6... not too familiar with .net. i tried to make a hello world program in .net, but surprise surprise, it doesn't work! thats the code, coudln't be simpler, but it doesnt' understand what "cout" means!!


#include <iostream>

int main(){

cout << "hello world";
}


would be great if someone could let me know whats going on!
thanks,
drew
 
sorry.. i forgot to mention a few things.

using the line "using namespacestd" solves the problem on some computers, but not on all of them. i heard that there were some changes in .net so that printing to the console could be done in the same way from vb, c++, C# etc. is that true? and if so, how do you do it?

thanks!
drew.
 
Are you talking about C++, Managed C++, or C#?

If you are talking about C++, you can still stick with cout (as long as the ANSI commitee doesnt change C++ standard).

There are 2 ways to solve your problem ...

Code:
#include <iostream>

using namespace std;

int main()
{
   cout<<"Hello world\n";
}

or

Code:
#include <iostream>

int main()
{
   std::cout<<"Hello world\n";
}
 
thanks!

just curious tho.. why did they feel they needed to change this? is this common to c#, vb .net etc too? or is it just for c++? and how come "using namespace std" doesn't work on all computers?

thanks again,
drew
 
I am not sure where you heard that from but so far I have no problem with "using namespace std" on different computers.

C++ is not a propriety language. It means that C++ is not owned by any company, and its standard is set by a non-profit ANSI commitee (not Microsoft).

If you are talking about Managed C++, C#, and VB, then you should ask Microsoft why they keep on changing stuffs. ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top