Re: String.h

From: Noah Roberts (nroberts_at_dontemailme.com)
Date: 01/29/04


Date: Thu, 29 Jan 2004 01:01:38 -0800

SenderX wrote:
>>#include <iostream.h>
>>#include <string.h>
>>
>>int main() {
>> string Name;
>> Name = "Carl";
>> cout << Name << endl;
>> return 0;
>>}
>
>
>
> #include <iostream>
> #include <string>
>
> int main()
> {
> std::string Name = "Carl";
>
> std::cout << Name << std::endl;
>
> return 0;
> }
>
>

or

#include <string>
#include <iostream>

using namespace std;

int main(void)
{
    string Name = "Carl";
    cout << Name << endl;

    return 0;
}

-- 
"I can't help it, the Dominating Trolls made me."


Relevant Pages

  • Re: input and output questions about file
    ... using namespace std; ... junk.c:5: warning: type defaults to `int' in declaration of `std' ... junk.c:10: `string' undeclared ... junk.c:12: parse error before '/' token ...
    (comp.lang.c)
  • Re: Comparing files (Fast)
    ... I didn't knew what is was, but using fseek solved the problem. ... I'm using a timer utility Scott Meyers wrote for use ... > using namespace std; ... > int ch1,ch2; ...
    (comp.lang.cpp)
  • Re: return memory to the OS
    ... > 4 using namespace std; ... > 5 int main ... > possible to make STL return this memory to the OS (say using a system ... :: "out of confusion comes chaos -- out of chaos comes confusion and fear ...
    (comp.lang.cpp)
  • Re: Huge Floating Point Error
    ... using namespace std; ... int main ... floating point math is different from integer math. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: New to c++.net (need help)
    ... > using namespace std; ... > int main ... Here's a hint for when ... your program is behaving other than how you expect, ...
    (alt.comp.lang.learn.c-cpp)