This is probably the compiler's fault, but I'm not sure...
This compiles and runs just fine:
Code:
This, however, gives me an error that says "error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<
char> >' (or there is no acceptable conversion)":
Code:
I think the problem is that my compiler is too old. I'm using Microsoft Visual C++, but the copyright dates in the About were 1994-1998. What compiler would you guys suggest? I need one that can be downloaded for free online that is fairly easy to use, as I'm not going to be doing any uber-advanced programming anytime soon.
This compiles and runs just fine:
Code:
#include <iostream.h>
#include <string>
using std::string;
int main()
{
string hello;
hello = "Hello World!";
return 0;
}
This, however, gives me an error that says "error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<
char> >' (or there is no acceptable conversion)":
Code:
#include <iostream.h>
#include <string>
using std::string;
int main()
{
string hello;
hello = "Hello World!";
cout<<hello;
return 0;
}
I think the problem is that my compiler is too old. I'm using Microsoft Visual C++, but the copyright dates in the About were 1994-1998. What compiler would you guys suggest? I need one that can be downloaded for free online that is fairly easy to use, as I'm not going to be doing any uber-advanced programming anytime soon.