c语言中错误c2228,error C2228:left of '.Push' must have class/struct/union type

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<

}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值