A
as mellow as a horse
I'm not new to C++, but it has been a while, and I'm defintely new to dot
net.
So to get back into the swing of things, I tried to create the ubiqitous
"hello world" program using a console application. Most of the C++
programming I've ever done has been in Borland products (mostly C++ Builder)
and all I ever needed to do a "hello world" was include "iostream.h".
But when I do that in dot net, I get a fatal error saying file not found.
After much searching through online help, I find I have to drop the "h" and
just include "iostream". But when I did that I found my cout line was
causing an error. After much more searching through help files, I discover
I have to qualify cout with a namespace i.e. "std::cout" or use a "using
namespace std" directive. I've never used namespaces in C++ before,
although I'm aware of them through dabbling in XML.
So all works well, but then I find that namespaces only apply to "iostream"
and I can use "iostream.h" to avoid having to use them. So my question is
(at last!):
How do I include "iostream.h" when dot net can't/won't find it, and should I
be doing so anyway i.e. is it the done thing now to use namespaces
everywhere and thus only use iostream?
net.
So to get back into the swing of things, I tried to create the ubiqitous
"hello world" program using a console application. Most of the C++
programming I've ever done has been in Borland products (mostly C++ Builder)
and all I ever needed to do a "hello world" was include "iostream.h".
But when I do that in dot net, I get a fatal error saying file not found.
After much searching through online help, I find I have to drop the "h" and
just include "iostream". But when I did that I found my cout line was
causing an error. After much more searching through help files, I discover
I have to qualify cout with a namespace i.e. "std::cout" or use a "using
namespace std" directive. I've never used namespaces in C++ before,
although I'm aware of them through dabbling in XML.
So all works well, but then I find that namespaces only apply to "iostream"
and I can use "iostream.h" to avoid having to use them. So my question is
(at last!):
How do I include "iostream.h" when dot net can't/won't find it, and should I
be doing so anyway i.e. is it the done thing now to use namespaces
everywhere and thus only use iostream?