-
What is wrong? :(
Code:
#include <iostream.h>
#include <string>
using namespace std;
int main(){
string string1 = "hello";
cout << string1 << '\n';
return 0;
}
I get the error:
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 acceptabl
e conversion)
why?
-
You need to use <iostream>, not <iostream.h>. <iostream.h> is the older, non-standard, deprecated version of the stream libraries :)
-
-