Guest_imported
New member
- Jan 1, 1970
- 0
I was trying to print a substring on to the screen and got the error below. Any ideas?
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)
The code that generated the error is as below:
#include <iostream.h>
#include <stdlib.h>
#include <string>
using namespace std;
main()
{
string state("empire"
cout <<state.substr(1,7)<< endl ;
}
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)
The code that generated the error is as below:
#include <iostream.h>
#include <stdlib.h>
#include <string>
using namespace std;
main()
{
string state("empire"
cout <<state.substr(1,7)<< endl ;
}