Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 64 results for
shunting-yard
- Page 1
Shunting Yard and Evaluation of expression in c++ pseudo code
Programming
Software Development
9 Years Ago
by Joemeister
… a infix mathematical expression into a postfix expression using the
shunting
yard
algortihm but can only get so far by writing the… be able to help me. This is my pseodo code:
Shunting
Yard
: string shuntingYard(string expression) { string postFix = ""; //An initially…
Re: Shunting Yard and Evaluation of expression in c++ pseudo code
Programming
Software Development
9 Years Ago
by L7Sqr
I wrote a code snippet (in C++) not too long ago for doing just this. You can find it [here](http://www.daniweb.com/software-development/cpp/code/427500/calculator-using-
shunting
-
yard
-algorithm)
Calculator using shunting-yard algorithm
Programming
Software Development
11 Years Ago
by L7Sqr
…, converts them to reverse polish notation by way of the
shunting
-
yard
algorithm and then evaluates the resulting expression. I tried to… theory, they could be pulled out and used independently. The
shunting
-
yard
behavior is provided via `class ShuntingYard`; I used the visitor…
Re: Calculator using shunting-yard algorithm
Programming
Software Development
11 Years Ago
by happyuk
Nice article! For coding up the
Shunting
Yard
algorithm I personally found the following Wiki pages very useful: …http://en.wikipedia.org/wiki/
Shunting
-yard_algorithm http://en.wikipedia.org/wiki/Reverse_Polish_notation So long as…
Re: Shunting Yard and Evaluation of expression in c++ pseudo code
Programming
Software Development
9 Years Ago
by Joemeister
Awesome code! Thank you! My other problem now is in my main.cpp I have a string like this: #include <iostream> #include "Expression.h" using namespace std; int main() { /* Creating Expression objects. Notice that all operators and operands are seperated by spaces. This will …
Re: Shunting Yard and Evaluation of expression in c++ pseudo code
Programming
Software Development
9 Years Ago
by L7Sqr
Without seeing the `Expression` class I'd assume to construct the following: class Expression { std::map< std::sring, double > symtab_; // ... public: double instantiateVariable (const std::string &var, double val) { std::map< std::string, double >::iterator sti = symtab_.find (var);…
Re: Shunting Yard and Evaluation of expression in c++ pseudo code
Programming
Software Development
9 Years Ago
by Joemeister
Oh yeah sorry about that! Here is my class and it's members. #ifndef EXPRESSION_H #define EXPRESSION_H #include <string> #include <iostream> using namespace std; class Expression { private: //...; public: /*The constructor receives a string expression in infix…
Re: Shunting Yard and Evaluation of expression in c++ pseudo code
Programming
Software Development
9 Years Ago
by L7Sqr
That is just the interface you are exposing. My comment was more to the point of not knowing what you had already implemented. Regardless, you can use the symbol table idea I provided above to manage the expression internals (variables, values, etc.). As I mentioned in your other post, propagating the expression as a string is a bad idea; it …
Re: Shunting Yard and Evaluation of expression in c++ pseudo code
Programming
Software Development
9 Years Ago
by Joemeister
Currently, in your program. The infix does not contain any variables for ex. x * (2 + 3) and it only uses digits. How can I instantiate the variables in the expression (with a function) - giving the x, for example a value. AND then continue with the "new" infix, where the values are added?
Re: Shunting Yard and Evaluation of expression in c++ pseudo code
Programming
Software Development
9 Years Ago
by iamthwee
Couldn't you just substitute the variables for numbers before you do anything? Surely it would be a simple string replace.
Re: Calculator using shunting-yard algorithm
Programming
Software Development
11 Years Ago
by mike_2000_17
This is very nice! It's a neat little piece of designed code to solve a somewhat simple problem but in a fairly generic way. That's cool, it's the kind of code I like to see. As usual, I could point out a few things to improve. At least, there is one thing that could be a nice improvement to this design and other similar designs (as this is a …
Re: Calculator using shunting-yard algorithm
Programming
Software Development
11 Years Ago
by iamthwee
Nice snippet. Mike makes some really good points about the semantics of the language you have used to program this in. I'm going to make a few suggestions about the practical use of this... Bear in mind I haven't tested your code completely at all so other issues may exist. Your code falls flat on it's face when unary operators are considered.…
Re: Calculator using shunting-yard algorithm
Programming
Software Development
11 Years Ago
by L7Sqr
@mike_2000_17: Thank you for taking the time to provide the feedback you did! I agree with decoupling the `Calculator` and `TokenBase` and just didn't consider it as I was writing the code. As for the reduction of the switch to a more maintainable construct - I really like the approach you suggested. I toyed with a way to make that better but …
Re: Calculator using shunting-yard algorithm
Programming
Software Development
11 Years Ago
by TrustyTony
I think better approach would be to just 'transparentely add +'. I mean that you do not have substraction routine but enter adding with negation flag set for number scanner. Then you just toggle the negation flag for minus ignoring plusses. That could be handled by suffiently competent number parser. > Not quite as aesthetically pretty as…
drawing with c++
Programming
Software Development
14 Years Ago
by AirGear
… the equation. I already implemented Reverse Polish Notation, and also
shunting
-
yard
algorithm. But, i found out that all my friends focused… user int ukuranPost=0; //banyak sel post yang terisi double
shunting
(double); //
shunting
-
yard
algorithm void postfix(string); //mengubah infix menjadi postfix double…
ADT Tree Building + Parseing user Input
Programming
Computer Science
13 Years Ago
by Annuate
… the [URL="http://http://en.wikipedia.org/wiki/
Shunting
-yard_algorithm"]
Shunting
-
yard
algorithm[/URL]. This will take infix notation and convert…
Receiving stack errors when trying to evaluate a postfix expression
Programming
Software Development
9 Years Ago
by Joemeister
… parameter is a postfix string that was done through a
shunting
yard
algorithm and is now passed through to the evaluate function…
Easiest way to implement this in Java
Programming
Software Development
9 Years Ago
by nataraja833
… (i.e 1,0,x ) . Currently I'm thinking of
Shunting
Yard
Alogo to create the string from infix to posix notiation…
Re: Easiest way to implement this in Java
Programming
Software Development
9 Years Ago
by Taywin
… take up the most code line is the parsing. In
Shunting
yard
, it simply converts a string to posix notation. If you…
Re: Please help about to postfix statement conversion
Programming
Software Development
15 Years Ago
by Salem
Shunting
yard
algorithm
Re: compile c++ using another c++ file
Programming
Software Development
14 Years Ago
by AirGear
… post yang terisi string input; double xkiri,xkanan; double
shunting
(double); //
shunting
-
yard
algorithm void postfix(); //mengubah infix menjadi postfix double convert… x kanan : "; cin>>xr; fxl=
shunting
(xl); fxr=
shunting
(xr); } else { cout<<"Tidak ada …
Re: Infix to postfix using queue
Programming
Software Development
14 Years Ago
by quuba
…] [QUOTE]Converting from infix notation Main article:
Shunting
-
yard
algorithm Edsger Dijkstra invented the
Shunting
-
yard
algorithm to convert infix expressions to postfix (RPN…), so named because its operation resembles that of a railroad
shunting
yard
. There are other ways of producing postfix expressions from infix…
Re: binary integer logic
Programming
Computer Science
17 Years Ago
by p_eqlz_np
… for evaluation RPN-style is rather fast (using a "
shunting
yard
" algorithm, read it up) and is rather easy to… i have actually been doing so far is implementing the
shunting
yard
algorithm.
Re: Code Snippet Contest
Community Center
Geeks' Lounge
11 Years Ago
by L7Sqr
My submission. A simple [calculator](http://www.daniweb.com/software-development/cpp/code/427500/calculator-using-
shunting
-
yard
-algorithm). Internally uses reverse polish notation format generated using
shunting
-
yard
algorithm.
Re: C++ calculator problem
Programming
Software Development
12 Years Ago
by L7Sqr
[QUOTE=thecoolman5;1626900] How would you do it?[/QUOTE] I'd start by removing [i]all[/i] the [icode]goto[/icode]s. From there I would look at the [url=http://en.wikipedia.org/wiki/
Shunting
-yard_algorithm]
Shunting
-
Yard
algorithm[/url].
Re: I want to create a calculator on c sharp
Programming
Software Development
12 Years Ago
by gusano79
For the math part, read about the [
shunting
-
yard
algorithm](http://en.wikipedia.org/wiki/
Shunting
-yard_algorithm).
Re: Advanced string functions, math generator
Programming
Software Development
11 Years Ago
by gusano79
I think you'll get the most value out of working with [parse trees](http://en.wikipedia.org/wiki/Parse_tree) of the expressions rather than trying to do it all with string manipulation. For reading in text equations, have a look at the [
shunting
-
yard
algorithm](http://en.wikipedia.org/wiki/
Shunting
-yard_algorithm).
Re: evaluvation of arithmetic expressions
Programming
Software Development
11 Years Ago
by Gonbe
… formula's you might want to look at Dijkstra's
Shunting
Yard
algorithm. Information on this can be found here: http://en…
Re: MDAS Program help.
Programming
Software Development
11 Years Ago
by Gonbe
That's somewhat complex for someone learning C. An algorithm I'd use for parsing these kind of formula's would be the [
Shunting
-
yard
algorithm](http://en.wikipedia.org/wiki/
Shunting
-yard_algorithm) by Dijkstra. The article contains example code for C too.
Re: Parsing Implementation - Algebra Parsing Advice?
Programming
Computer Science
10 Years Ago
by gusano79
… approach to parsing algebraic expressions is the [
shunting
-
yard
algorithm](http://en.wikipedia.org/wiki/
Shunting
-yard_algorithm). It's powerful enough to deal…
1
2
3
Next
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Forums
Top Members
Meet People
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC