For class I have to use a stack to find if a word entered by the user is a palindrome...

#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main()
	char *word; int count;
	stack <char> mystack;
	stack <char> rev_stack;

	cout<<"Enter a string ";




		cout<<"The word "<<word<<" is PALINDROME.";
		 cout<<"The word "<<word<<" is NOT PALINDROME.";

From this code I get:

error C3861: 'isEmpty': identifier not found

What is it that i need to do?

>> What is it that i need to do?

You need to either write your own isEmpty() function or you need to use one of the functions provided by C++'s stack. There is no isEmpty() function in stack, and even if there was, you would still get the error since the compiler has no idea the call has anyhting to do with the stack class in line 23.

Compare line 23 to your (correct) call in line 25.

Edit : line 25 looks bad too. Why are you pushing a stack onto a stack? Line 17 looks better. Use it as your model.

Edited 5 Years Ago by VernonDozier: n/a

You are calling a function 'isEmpty()'. That does not exist anywhere, does it?
If you want to check if a stack is empty, you can call 'empty()' on the stack.


while( !myStack.empty() )
This article has been dead for over six months. Start a new discussion instead.