Hi i have just begun to develop a calculator in C++.net. I have created 10 buttons on the form 0 to 9 and the usual operands + - * / = etc. I want the code to work out the preceidence i.e. * before / etc but cant seem to understand how to do this. The code currently uses a string to concatinate the numbers then when an operand is selected it is converted to an double value and stored as a variable. Can anyone help me please as i am really confused about the matter or preceidence and how to begin to work it out in c++.net i dont know how to get the code to look at each operand in a string of chars.
teked
0
Newbie Poster
Recommended Answers
Jump to Post>i.e. * before / etc
Multiplication and division have the same precedence.>i dont know how to get the code to look at each operand in a string of chars.
You would save yourself a lot of trouble by using a stack to either build a parse tree, or …
All 4 Replies
Narue
5,707
Bad Cop
Team Colleague
Chainsaw
12
Posting Pro in Training
priyad2
0
Newbie Poster
priyad2
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.