newbieKing
Programmer
I've been using Borland 5.0, and am trying to use Visual C++ 6.0.
outputting a string in borland is fine but i can't seem to cout strings in visual. Am i missing an include file??
This is what i've included:
#include <math.h>
#include <conio.h>
#include <iomanip.h>
#include <fstream.h>
#include <string>
#include <vector>
#include <stdlib.h>
#include <assert.h>
using namespace std;
void main()
{
string word = "hello";
cout << word;
}
stirng2.cpp
c:\documents and settings\laurence\my documents\visual c++\first simulation\stirng2.cpp(15) : 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 s
td::allocator<char> >' (or there is no acceptable conversion)
Error executing cl.exe.
Please tell me what i'm missing.
Thank you!
outputting a string in borland is fine but i can't seem to cout strings in visual. Am i missing an include file??
This is what i've included:
#include <math.h>
#include <conio.h>
#include <iomanip.h>
#include <fstream.h>
#include <string>
#include <vector>
#include <stdlib.h>
#include <assert.h>
using namespace std;
void main()
{
string word = "hello";
cout << word;
}
stirng2.cpp
c:\documents and settings\laurence\my documents\visual c++\first simulation\stirng2.cpp(15) : 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 s
td::allocator<char> >' (or there is no acceptable conversion)
Error executing cl.exe.
Please tell me what i'm missing.
Thank you!