error C2228:left of '.Push' must have class/struct/union type0
一串都是这个错误 头疼死了 我怎么就发现不了哪里错了 分不多 麻烦了 谢谢
#include
const int stack_size=100;
template
class seqstack
{
public:
seqstack(){top=-1;}
seqstack(T a[],int n);
~seqstack(){}
void Push(T x);
T Pop();
T GetTop(){if(top!=-1) return data[top];}
int Empty(){if(top!=-1) return 1; else return 0;}
private:
T data[stack_size];
int top;
};
template
seqstack::seqstack(T a[],int n)
{
top=-1;
for(int i=0;i
data[++top]=a[i];
}
template
void seqstack::Push(T x)
{
if(top==stack_size-1) throw"上溢";
data[++top]=x;
}
template
T seqstack::Pop()
{
if(top==-1) throw"下溢";
return data[top--];
}
int jisuan(int a,int b,char c)
{
if(c=='+')
return a+b;
if(c=='-')
return a-b;
if(c=='*')
return a*b;
if(c=='/')
return a/b;
}
int panduan(char a)
{
if(a=='0'&&'1'&&'2'&&'3'&&'4'&&'5'&&'6'&&'7'&&'8'&&'9')
return 1;
else
return 0;
}
int yunsuanfu(char a)
{
switch(a)
{
case '+':return 1;break;
case '-':return 1;break;
case '*':return 2;break;
case '/':return 2;break;
case '#':return 0;break;
}
}
void main ()
{
char a[]="#7+2*3#";
cout<
int i=0;
int z=0;
seqstack optr();//运算对象
seqstack opnd();//运算符
opnd.Push(a[0]);
char b=opnd.GetTop();
while(a[i++]!='#')
{
if(panduan(a[i])==1)
{
int t=a[i].praseInt();
optr.Push(t);
}
else
if(yunsuanfu(a[i])>yunsuanfu(b))
opnd.Push(a[i]);
else
{
int x=optr.Pop();
int y=optr.Pop();
char c=opnd.Pop();
z=jisuan(x,y,c);
optr.Push();
}
}
cout<
}