New Member FAQ
|
Forums
|
Earn Revenue
|
Posting Guidelines
|
Help Topics
Resources
Practice Tests
Ask Experts
Question Papers
Jobs
Study in UK
Universities
Colleges
Courses
Schools
Training
Gift Shop
|
Bookmarks
|
Reviews
|
Learn English
|
Lobby
|
Links
|
New Posts
|
My India
|
Members
|
Polls
|
My Profile
Sign In
Register
AdSense Revenue
Awards & Gifts
Active Members
Today
R Pramod
(198)
M.A. Vimala
(91)
Gypsy
(86)
Last 7 Days
Gypsy
(1984)
R Pramod
(1958)
M.A. Vimala
(909)
more...
Evaluation of PostFix Expression
Posted Date: Total Responses:
0
Posted By:
pankaj agarwala
Member Level:
Silver
Points/Cash
: 3
###
C Program of Evaluation of PostFix Expression
#define MAX 50
#include
#include
#include
float stack[MAX];
int top=-1;
void push(float val)
{
if(top==MAX-1)
return ;
stack[++top]=val;
}
float pop()
{
if (top==-1)
return -9.9;
else
return stack[top--];
}
void main()
{
clrscr();
char post[20];
int i=0;
float A,B,C;
printf("\n Enter expression");
gets(post);
while(post[i]!='\0')
{
if(isdigit(post[i]))
push(post[i]-48);
else if(post[i]!=32)
{
A=pop();
B=pop();
if(post[i]=='*')
C=B*A;
else if(post[i]=='/')
C=B/A;
else if(post[i]=='+')
C=B+A;
else if(post[i]=='-')
C=B-A;
push(C);
}
i++;
}
printf("\n result=%f",stack[0]);
getch();
}
Project Feedbacks
No feedbacks found. Be the first to respond...
Post Feedback
You must
Sign In
to post a feedback.
Next Project:
Conversion of infix expression to postfix expression
Previous Project:
Implementation of Quick Sort
Return to Project Index
Post New Project
Related Projects
Implementation of Circular Queue using Array
To Develop a Java project for Server Test
Implementation of error detecting technique(CRC) using C Language.
Java program to reverse a string and to check palindrome or not
C program for Multiple Stack
Subscribe to Email
Get Jobs by Email
Forum posts by Email
Articles by Email
Online Members
benson gomez
Ashish Kumar
Iti Tyagi
Sakshi Sood
dks
Arvind
siva
sathishkumar
Shiyas
Kamlesh. M. Dhurve
Saraswathi
More...
About Us
Contact Us
Copyright
Privacy Policy
Terms Of Use
AdSense Revenue Sharing sites
Advertise
Talk to
Tony John
ISC Technologies, Kochi - India
2006 - 2012 All Rights Reserved.