hi, sorry to disturb again, currently i have an assignment on stacks and as show in the the title, i need to use stacks to determine palindrome.
i've done part of my code, here it is:
alright, i am stuck again, i need to ignore space, punct and digits, i know using isdigit / ispunct / isspace. however i ahh.. duno where to put them. hmmm, simple guide will do. thanks, meanwhile, i will be doing search on google as well. please help. thanks
i've done part of my code, here it is:
Code:
// Write your name, student number, part-time/full time, degree here #include <string> #include <iostream> #define STACKSIZE 80 #define TRUE 1 #define FALSE 0 using namespace std; class Stack { public: void StackInit(); int IsStackEmpty(); int IsStackFull(); int StackPush(char c); char StackPop(); char ViewStackTop(); private: char myStack[80]; int top; }; string pstring; int main() { // write your code here cout << "This Is A Palindrome Check Programe" << endl; cout << "Please Enter Anything For Palindrome Check" << endl; cin >> pstring; system("pause"); return 0; } void Stack::StackInit() { top = -1; } int Stack::IsStackEmpty() { if (top == -1) return TRUE; return FALSE; } int Stack::IsStackFull() { if (top == (STACKSIZE - 1)) return TRUE; return FALSE; } int Stack::StackPush(char c) { if (top == (STACKSIZE - 1)) return FALSE; myStack[++top] = c; return TRUE; } char Stack::StackPop() { if (top == -1) return '\0'; return myStack[top--]; } char Stack::ViewStackTop() { if (top == -1) return '\0'; return myStack[top]; }
Comment