Please help with palindrome code.

Please help, i am suppose to Create a class called Palindrome. This class will have a single function called isPalidrome which will accept a SINGLE seven-digit integer parameter and returns a value of type bool (true or false) – true if the integer that is passed to the function is a palindrome and false if it isn’t. (Hint: Use the division and modulus operators to separate the number into its individual digits.)
I am having trouble calling the fuctions however i do not know what goes in the palindrome.cpp file.


This is my driver file/main.cpp

#include <iostream>
using std::cout;
using std::cin;
using std::endl;

#include "palindrome.h"

int main()
{

cout<<"Creating Palindrome object\n\n\n";
Palindrome pal;
if (pal.isPalindrome(1234321))
cout<<"1234321 is a palindrome (this should print)\n";
else
cout<<"1234321 is not palindrome\n";

if (pal.isPalindrome(1230321))
cout<<"1230321 is a palindrome (this should print)\n";
else
cout<<"1230321 is not palindrome\n";

if (pal.isPalindrome(1212432))
cout<<"1212432 is a palindrome\n";
else
cout<<"1212432 is not palindrome (this should print)\n";
}


and dis is my palindrome.h file
#ifndef PALINDROME_H
#define PALINDROME_H


class Palindrome
{
public:
Palindrome();
bool isPalindrome(int value);


};

#endif // PALINDROME_H

not sure if the parameter for the function is correct
please help if you can

Doesn't your textbook tell you how to implement a class ?

Palindrome.cpp
1
2
3
4
5
6
7
8
9
10
#include "palindrome.h"
Palindrome::Palindrome()
{
  // ctor is not doing anything and not needed
}

bool Palindrome::isPalindrome(int value)
{
  // your code here
}
Duplicate of:

http://www.cplusplus.com/forum/general/244248/

Please DON'T do that. It wastes everyone's time, including your own.
Topic archived. No new replies allowed.