Question about strings
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
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]
Edit: don't use <comment> on your site, use <!-- and -->
[edited by - EL on August 7, 2003 4:50:12 PM]
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".
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".
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
There''s no town drunk here, we all take turns.
Velocity Gaming Force
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 )
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"
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"
quote:Original post by ELquote: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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement