Question about strings

Started by
6 comments, last by Ekim_Gram 20 years, 8 months ago
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
Advertisement
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]
el
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".

Kippesoep
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 is also an #include <string> header file too.
Well, R2D22U2..
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 )
el
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"
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
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.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.

This topic is closed to new replies.

Advertisement