c++ help needed

A

akshaycjoshi

Well in bloodshed c++ i am able to run the following program :
Code:
#include <iostream.h>
using namespace std;

int main()
{
cout << "Hello World!" << endl;
cout << "Press any key to continue." << endl;
cin.get();
return 0;
}




I am using the .h extension which don't support namespaces and still
able to run it .
what the hell ?

Also Code:
#include <iostream.h>
#include<string.h> //how can i use that ?
using namespace std; //with this ?

int main()
{
cout << "Hello World!" << endl;
cout << "Press any key to continue." << endl;
cin.get();
return 0;
}
 
J

Jim Langston

Well in bloodshed c++ i am able to run the following program :
Code:
#include <iostream.h>
using namespace std;

int main()
{
cout << "Hello World!" << endl;
cout << "Press any key to continue." << endl;
cin.get();
return 0;
}




I am using the .h extension which don't support namespaces and still
able to run it .
what the hell ?

Also Code:
#include <iostream.h>

#include<string.h> //how can i use that ?

This is the old C header for c-style strings. strcpy, strcmp, etc...
<cstring> is the std namespace version of it.
<string> is the one for std::string.

Try to actually create a std::string in your program and you should get an
error becuase std::string is not defined.
 
B

BobR

Jim Langston wrote in message...
should be <iostream> but I guess bloodshed has this old one kicking aroiund
that may be pre-standard, not sure.

Not 'bloodshed' (Dev-C++ IDE), it's GCC(MinGW):

<root>\Dev-Cpp\include\c++\3.3.1\backward\iostream.h.

Seems like that should never have been there after the 2.95 series, IMHO.

[ note to self: upgrade that poor old (3.3.1) puppie!! <G> ]
 
A

akshaycjoshi

Jim Langston wrote in message...
should be <iostream> but I guess bloodshed has this old one kicking aroiund
that may be pre-standard, not sure.

Not 'bloodshed' (Dev-C++ IDE), it's GCC(MinGW):

<root>\Dev-Cpp\include\c++\3.3.1\backward\iostream.h.

Seems like that should never have been there after the 2.95 series, IMHO.

[ note to self: upgrade that poor old (3.3.1) puppie!! <G> ]

But how to update ???
Can u end me the link ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top