answersLogoWhite

0


Best Answer

//made by vijay sahu

#include

#include

void main()

{

char p[20];

int stack[15];

int ts=-1,top=0;

int l=strlen(p);

cout<<" \n enter postfix expression";

cin>>p;

for(int i=0;i

{

if(p[i]>=48 && p[i]<=57)

stack[++ts]=p[i]-48;

else if(p[i]=='+' p[i]=='-' p[i]=='*' p[i]=='/')

{

int t1=stack[ts--];

int t2=stack[ts--];

switch(p[i])

{

case '+':

stack[++ts]=t1+t2;

break;

case '-':

stack[++ts]=t2-t1;

break;

case'*':

stack[++ts]=t1*t2;

break;

case '/':

stack[++ts]=t2/t1;

break;

}

}

}

cout<

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Writ evolution program ofInfix convert postfix without using classes or structures?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions