i get this error when i try executing it,
no match for the operator ==
now i understand you can't compare a string with a char, so i tried other method like strcmp, covert a to char, but none worked.
note: coverting d to string is not an option.
#include <iostream>
#include<string>
using namespace std;
int main(int argc, char *argv[])
{
int i;
char d='h';
string s="this is a string";
string a;
a=s.substr(1,1);
if(a==d)
cout<<"String compared\n";
cout<<a<<"\t"<<s<<"\n";
cin>>i;
return 0;
}