Archived

This topic is now archived and is closed to further replies.

Ekim_Gram

Question about strings

Recommended Posts

Ok, I made a program that used a string in it. I compiled it and it had errors. But once I put in using namespace std; in the code, it compiled without errors. So my question to you is "Do you need to have using namespace std in your code to use strings?".
There''s no town drunk here, we all take turns. Velocity Gaming Force

Share this post


Link to post
Share on other sites
Yes, or use std::string.
Edit: don't use <comment> on your site, use <!-- and -->

[edited by - EL on August 7, 2003 4:50:12 PM]

Share this post


Link to post
Share on other sites
Or use "using std::string;"
This, or importing the entire std namespace makes sure that "string" actually maps to "std::string".

If you don''t do that, the compiler won''t know what "string" is and you have to explicitly tell it you mean "std::string".

Share this post


Link to post
Share on other sites
quote:
Original post by Ekim_Gram
Ok, thanks a lot both of you. And EL, it''s not my site, I just work there.



There''s no town drunk here, we all take turns.
Velocity Gaming Force

OK, didn''t know that, it''s just a pain to look at it with Firebird (let them know )

Share this post


Link to post
Share on other sites
You can put:

using std::string;

at the top also, then you won''t kill the namespace, but you can use string as normal :-)

----------------------------------------------
Petter Nordlander

"There are only 10 kinds of people in the world. The who understand binary and those who don''t"

Share this post


Link to post
Share on other sites
quote:
Original post by EL
quote:
Original post by Ekim_Gram
Ok, thanks a lot both of you. And EL, it''s not my site, I just work there.



There''s no town drunk here, we all take turns.
Velocity Gaming Force

OK, didn''t know that, it''s just a pain to look at it with Firebird (let them know )



That looks pretty funny.

Share this post


Link to post
Share on other sites