Here, the comparison can be done in three ways.
one - by using strcmp() function
Two - by using compare() function
or else we can directly compare two strings by using comparison operator.
Here I am showing you one of the way by using comparison operators:
let's say we have 2 strings
string a=”abcd”;
string b=”abcd”;
So here we can simply use ‘==’ operator to check if they are equal or not
if(a==b) return true;
else return false;
In order to know more about this you can read
this article here.