لدي برنامج وقد قمت بحله ,, ولكن لدي اخطاء بسيطه لا ادري ان كانت في (الفنكشن) ام جهازي لايعمل جيدا
i want write a program that will read integer number anf then print whether this number digits are palindrome or not>
# include <iostream>
#include <assert.h>
using namespace std;
template <class Type>
class stackType
{
private:
Type *list;
int stackTop;
int maxSize;
public:
stackType(int);
int isEmpty();
int isFull();
void push(Type& item);
void pop();
Type Top();
void palindrome(stackType<Type>&s);
};
template <class Type>
stackType<Type>::stackType(int size=100)
{
if(size<=100)
maxSize=100;
else
maxSize=size;
stackTop=0;
list=new Type[maxSize];
assert(list !=NULL);
}
template <class Type>
int stackType<Type>::isEmpty()
{
bool found=true;
if(stackTop=0)
return true;
else
return false;
}
template <class Type>
int stackType<Type>::isFull()
{
bool found=true;
if(stackTop=maxSize)
return true;
else
return false;
}
template <class Type>
void stackType<Type>::push(Type& item)
{
if(isFull())
cout<<"full stack>>";
else
{
list[stackTop]=item;
stackTop++;
}
}
template <class Type>
void stackType<Type>::pop()
{
if(isEmpty())
cout<<"is Empty>>";
else
stackTop--;
}
template <class Type>
Type stackType<Type>::Top()
{
assert(stackTop !=0);
return list [stackTop-1];
}
template <class Type>
void stackType<Type>::palindrome(stackType<Type>&s)
{
int digte;
cout<<"please enter your number";
cout<< endl;
cin>>digte;
int d=digte;
stackType <Type>s1; // stackType <Type>s2;
while(!s.isFull()) //(s!=0)
{
int y=digte;
int x=digte%10;
s.push(x);
s1.push(x);
digte=digte/10;
}
//while(!s1.isEmpty())
//{
// s2.push(s1.Top());
//s1.pop();
//}
while(!s.isEmpty())
{
if(s.Top()==s1.Top())
{
s.pop();
s1.pop();
}
else
{
break;
cout<<d<<"is not palindrome";
}
cout<<d<<"is palindrome";
}
}
int main()
{
int length;
cin>>length;
stackType<int>Q(length);
stackType<int>b(length);
Q.palindrome(b);
return 0;
}

