Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Create a Postfix Evaluation class that makes use of Infix2Postfix class an
evaluates an Infix Expression after converting it to Postfix.
Deliverables: C++ Code
Note:
Should done using Stack.h - Standard Template Library
Should done using Deque.h - Standard Template Library
Should done using Deque.h - Standard Template Library
+ Iterator Design Pattern

What I have tried:

stuck in deque.h help me so that i can code this give me hint or someone plz code this for me
Posted
Updated 25-Oct-22 3:47am
v3
Comments
k5054 24-Oct-22 12:57pm    
It's unlikely that the good people here will just give you a homework answer. That's not the way we do things here. But it sounds like you've got started, but you're now stuck. If you can give some indication of what's not clear to you, you may get some helpful response. Use the "improve question" link and add some more detail.
Richard Deeming 25-Oct-22 10:13am    
Editing your question to make it even less clear won't stop your teacher from finding your attempt to cheat on your homework.

I have rolled back your destructive edit.

You have to start somewhere and when it comes to programming, it is almost always best to start at the beginning. This means think about your problem: first you have to acquire an expression to evaluate. Next, you will need to tokenize the expression. This means to separate the components of the expression into tokens. I recommend that you tackle those two things first. I am sure you have acquired input strings before so I will skip that part. String tokenizing is an interesting thing and there are lots of ways to go about it. Here is a place to start : string tokenizer c++ at DuckDuckGo[^]. Best of luck with it.
 
Share this answer
 
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

Just a copy'n'paste of your assignment and "I tried" isn't going to get you anywhere.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
Quote:
Should done using Stack.h - Standard Template Library
Should done using Deque.h - Standard Template Library
Should done using Deque.h - Standard Template Library

C++ headers usually do not have an .h extension.
https://en.cppreference.com/w/cpp/container/stack
https://en.cppreference.com/w/cpp/container/deque
Is the third requirement duplicated, or should there be another requirement here?

As Rick has already suggested, it would make sense to first create some examples and then to decompose them. While decomposing check what should be on the stack first and how arithmetic operations and if necessary brackets have an effect.

Examples:
Infix:  A*B+C
Postfix: AB*C+
 
Infix:  (A+B)*(C/D)
Postfix: AB+CD/*
 
Infix:  A*(B*C+D*E)+F
Postfix: ABC*DE*+*F+
 
Infix:  (A+B)*C+(D-E)/F+G
Postfix: AB+C*DE-F/+G+
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900