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 ";
	cin>>word;

	while(*word!=NULL)
	{	
		mystack.push(*word);
		
		word++;

	}

	while(mystack!=isEmpty())
	{
		rev_stack.push(mystack)
	}

	if(strcmp(mystack,rev_stack)==0)
		cout<<"The word "<<word<<" is PALINDROME.";
   else
		 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.

http://www.cplusplus.com/reference/stl/stack/


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

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.

So:

while( !myStack.empty() )
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.