hi,
im trying to solve the following question:
Create a class responsible for determining whether a string is a palindrome. Show your test cases. Palindome mypal("bob");
mypal.Ispalindrome(); // should return true
i tried to do the code, but im having problems in comlpeting it, I hope that some one can help me know how im supposed to finish it off
this is the code that i did:
- #include <iostream>
-
#include <conio.h>
-
#include <string.h>
-
-
using namespace std;
-
-
class palindrome
-
{
-
string s;
-
palindrome()
-
{
-
s="null";
-
}
-
-
palindrome (string s1)
-
{
-
s=s1;
-
}
-
-
boolean Ispalindrome()
-
{
-
string s=s1.reverse;
-
if (s2==s1)
-
return true;
-
else
-
return false;
-
}
-
};
-
-
int main()
-
{
-
palindrome s1("How are you");
-
cout<<s1.Ispalindrome();
-
palindrome s2("BOB");
-
cout<<s2.Ispalindrome();
-
-
getch();
-
return 0;
-
}
these are the errors that i get:
1- syntax error before `)' token
2- syntax error before `}' token
3- In function `int main()':
4- ` palindrome:: palindrome(std::basic_string<char, std::char_traits<char>,
5- within this context
note: im using the dev c++ complier
thanks
outofmymind