How to transform it?

Can anyone give me the direction to how to transform the code below into recursive bool?

#include <string>
#include <iostream>

using namespace std;

bool Function(std::string str)
{//this function remove punctuation and space.


string String;

for (int i=0, j=0;i<str.length();i++)
{
if (str[i] >= 'A' && str[i] <= 'Z')
{
String.append(1,str[i] + 0x20); //make Lowercase by adding 0x20
}
else if (str[i] >= 'a' && str[i] <= 'z')
{
String.append(1,str[i]);
}
}



int len = String.length();//compareison

for (int i=0;i<len/2;i++)
{
if (String[i] != String[len-i-1])
{
return(false);
}
}

return(true);


}
int main()
{
string strIn;

cout<<"please enter a word phrase\n";
getline(cin,strIn);

if (Function(strIn))
cout<<"it is a palindrome"<<endl;
else
cout<<"it is not a palindrome"<<endl;
}
Topic archived. No new replies allowed.