bool is_less_than (const std::string& t, const std::string& s)
{
bool same = true;
string::const_iterator p1 = t.begin ();
string::const_iterator p2 = s.begin ();
while (p1 != t.end () && p2 != s.end ())
{
if (std::tolower (*p2) < std::tolower (*p1))
return false;
if (same && (std::tolower (*p2) != std::tolower (*p1)))
same = false;
*p1++;
*p2++;
}
if (same && (t.length() >= s.length ()))
return false;
else
return true;
}
int main()
{
string q = "queue";
string c = "cancel";
cout << is_less_than(q,c) << endl;
cout << is_less_than(c,q) << endl;
}