#include<iostream>
#include<string>
using namespace std;
void main(){
string str="abc";
cout<<str;
system("pause");
}
If i do not include string header file then there is an error at << in line cout<
I thought the error will be at line where str is defined.
void mainis not legal. It must returnint. Anyway, I've noticed MSVC used to be particularly fond of providing everything in<string>except the I/O through<iostream>, which is a bit ironic.ios_base::failure(and perhaps some others). But I don't think other unneeded non-member functions, such asto_stringare brought in.