This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to make it working correct(libstdc++)?


> From: TARZAN LION <tarzanboy@21cn.com>
> To: libstdc++@gcc.gnu.org

> #include <iostream.h>
> #include <string.h>
> 
> int main()
> {
>   string str("hello world!");
>   cout<<str<<endl;
>   return 0;
> }

Your program doesn't work with modern C++ compilers,
You should write it this way:
(BTW, this question belongs in the gcc help mailing list)


#include <iostream>
#include <string>
using namespace std;

int main()
{
  string str("hello world!");
  cout<<str<<endl;
  return 0;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]