Just use strcmp()
for case sensitive and strcmpi()
or stricmp()
for case insensitive comparison. Which are both in the header file
format:
int strcmp(const char*,const char*); //for case sensitive
int strcmpi(const char*,const char*); //for case insensitive
Usage:
string a="apple",b="ApPlE",c="ball";
if(strcmpi(a.c_str(),b.c_str())==0) //(if it is a match it will return 0)
cout<
Output
apple and ApPlE are the same
a comes before b, so apple comes before ball