Array rotation problem

#include
#include
using namespace std;
bool ispermutation(char *s1,char *s2)
{int i;
int l1=strlen(s1);
int l2=strlen(s2);
int freq[26]={0};
for(i=0;i<l1;i++)
{
freq[s1[i]-‘a’]++;
}
for(i=0;i<l2;i++)
{
freq[s1[i]-‘a’]–;
}
for(i=0;i<26;i++)
{
if(freq[i]!=0)
cout<<“false”;
}
cout<<“true”;
}
main()
{
char s1[100],s2[100];
cin>>s1>>s2;
ispermutation(s1,s2);

}
i am not able to find where i can put cout<<“true”;

In your code you are not returning anything from bool function. For this code you have to make 4 changes :

  1.  if( freq[i]!=0 ) 
             return false;
    
  2. and at the end instead of cout<<"true";   you have to use     return true;
    
  3. In second for loop of bool function u are using s1[i] which is wrong as you have to decrease the frequency according to s2[i]  
    
  4. in main function you will do int x=ispermutation(s1,s2); and then according to x you will output true and false.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.