Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool isPalindrome(int input) ///Testing input of 1234
- {
- int i = input;
- Stack inStack;
- while (i > 0)
- {
- inStack.push(i % 10);
- i /= 10;
- }
- int array[inStack.getCount()];
- int tempSize = inStack.getCount();
- for (int i = 0; i < inStack.getCount(); i++)
- {
- array[i] = inStack.pop();
- cout << array[i] << " "; //input of 1234 gives me 1 2 here
- }
- cout << endl;
- for (int i = 0; i < tempSize; i++)
- if (array[i] != array[tempSize - i])
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement