It returns the warning < String Sort>

StringSort.cpp: In function ‘bool mycompare(std::string, std::string)’:
StringSort.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type]
29 | }
| ^

#include
#include
#include

using namespace std;

bool mycompare(string a,string b)
{
char ch1=a[0];
char ch2=b[0];
if(ch1>ch2)
{
return a<b;
}
else
if(ch1==ch2)
{
int len1=a.length();
int len2=b.length();
if(len1>len2)
{
return a>b;
}
else
{
return b>a;
}
}
}
int main()
{
int n;
cin>>n;
cin.get();

string S[100];
for (int i = 0; i < n; i++)
{
    getline(cin,S[i]);
}
sort(S,S+n,mycompare);

for (int i = 0; i < n; i++)
{
    cout<<S[i]<<endl;
}

return 0;

}

please help me to solve this error

please help to resolve this warning

it return the warning

you need to return something before closing your function as your function is of bool type

not able to solve it.

add return false before closing the function …then debug your code for the sample test case