C++程序为什么一直报错 如何解决这个问题

#include
#include
using namespace std;
const int defaultsize=30;
template
class Stack {
private:
void operator =(const Stack&) {}
Stack(const Stack&) {}

public:
Stack() {}

virtual ~Stack() {}
virtual void clear() = 0;
virtual void push(const E& it) = 0;
virtual E pop() = 0;
virtual const E& topValue() = 0;
virtual int length() = 0;
};
template
class AStack: public Stack {
private:
int maxSize;

int top;

E listArray;

public:
AStack(int size=defaultsize){
maxSize = size;
top = 0;
listArray = new E [size];
}
~AStack(){
delete [] listArray;
}
void clear(){
top = 0;
}

void push(const E& it) {
assert(top!= maxSize);
listArray[top] = it;
top++;
}
E pop(){

assert(top!= 0);
return listArray[--top];
}
int length(){
return top;
}
};
int main(){
int ten=0,x,y,p,fir;
cout<<" 请输入初始进制:";
cin>>x;
cout<<" 请输入初始数值:";
cin>>fir;
cout<<" 请输入目标进制:";
cin>>y;
AStack sta1();
AStack sta2();
while(fir>0){
p=fir%10;
fir/=10;
sta1.push(p);
}
while(sta1.top!=0){
ten+=sta1.pop();
ten
=x;
}
ten/=x;
while(ten>0){
p=ten%y;
ten/=y;
sta2.push(p);
}
while(sta2.top!=0){
cout<<sta2.pop();
}
cout<<endl;
return 0;
}

 #include<iostream>
#include<cassert>
using namespace std;
const int defaultsize=30;
template <typename E> 
class Stack {
    private:
        void operator =(const Stack&) {}
        Stack(const Stack&) {}         
    public:
        Stack() {}                      
        virtual ~Stack() {}
        virtual void clear() = 0;
        virtual void push(const E& it) = 0;
        virtual E pop() = 0;
        virtual const E& topValue() = 0;
        virtual int length() = 0;
};
template <typename E> 
class AStack: public Stack<E> {
    private:
        int maxSize;                    
        E *listArray;          
    public:
        int top; 
        AStack(int size=defaultsize){ 
        maxSize = size; 
        top = 0; 
        listArray = new E [size];
        }
        ~AStack(){ 
        delete [] listArray;
        }
        void clear(){
            top = 0;
        }          
        void push(const E& it) {
            assert(top!= maxSize);
            listArray[top] = it;
            top++;
        }
        E pop(){                
            assert(top!= 0);
            return listArray[--top];
        }
        int length(){ 
            return top; 
        }
        const E& topValue()
        {
            assert(top!= 0);
            return listArray[top];
        }
};
int main(){
    int ten=0,x,y,p,fir;
    cout<<" 请输入初始进制:";
    cin>>x; 
    cout<<" 请输入初始数值:";
    cin>>fir; 
    cout<<" 请输入目标进制:";
    cin>>y;
    AStack<int> sta1;
    AStack<int> sta2; 
    while(fir>0){
        p=fir%10;
        fir/=10;
        sta1.push(p);
    }
    while(sta1.top!=0){
        ten+=sta1.pop();
        ten*=x;
    }
    ten/=x;
    while(ten>0){
        p=ten%y;
        ten/=y;
        sta2.push(p);
    }
    while(sta2.top!=0){
        cout<<sta2.pop();
    }
    cout<<endl;
    return 0;
}