Please can you execute this file then tell me what I have wrong in it ....
Thanks
The file is :
#include<iostream>
#include<string>
int main(){
string str1;
string str2;
cout<<"Please insert the First word"<< endl;
cin>>str1;
cout<<"Please insert the second word"<<endl;
#include<iostream>
#include<string>
int main(){
string str1;
string str2;
cout<<"Please insert the First word"<< endl;
cin>>str1;
cout<<"Please insert the second word"<<endl;
cin>>str2;
cout<< "thank you"<< endl;
bool an = anagrams(str1, str2);
if( ! an) {
cout<<" So sorry.. I cannot chick your strings..."<<endl;
cout<< " do you know math... can you count the characters.."<<endl;
cout<< "Please.. do it in a good way next time...by "<<endl;
}
else{
cout<< "they are anagrams";
}
return 0;
}
bool anagrams(string s1,string s2)
{
if ( s2.length()!=s1.length())
{
return false;
}
else{
swap(s1);
swap(s2);
if( s1 != s2 ) return true; else return flase;
}// else
}
string swap(string s){
char temp;
for (int i=0;i<s1.length();i++)
for (int j=i+1;j<str1.length();j++)
if (char(s[i])== char(s[j]){
temp = s[i];
s[i]= s[j];
s[j]= temp;
}//if statement
return s;
}
--------------
Thanks for your help////