Hi all, i need one help from u.when u give expression like 10+4*2-6/8 the expression should be evaluated in hierarchy order and the result will be displayed. the expression may be any longer or shorter.the operands used are +,-,*,/,mod, pow..please any one help in writing coding on this...
7 1193
Hi all, i need one help from u.when u give expression like 10+4*2-6/8 the expression should be evaluated in hierarchy order and the result will be displayed. the expression may be any longer or shorter.the operands used are +,-,*,/,mod, pow..please any one help in writing coding on this...
I'm not sure what you are asking for; please elaborate on your problem, and ask a question.
In any computer language, to force the order of precedence of calculations use brackets () as these have the highest order of precedence in computers and mathematics
As far as I was aware, languages usually take mathematical precedence in such calculations, doing multiplications, divisions, etc, then addition and subtraction.
You can force precedence with the use of brackets though.
i know, there ia already predefined function that calculate the expression, but i need the program that perform the calculation
i know, there ia already predefined function that calculate the expression, but i need the program that perform the calculation
If you know, why are you asking us? And what are you asking for? A PHP predefined function or a user defined function? Both seem pointless and inefficient because it can be done using basic mathematics
What you are asking is to write an interpreter written in an interpreter language, i.e. PHP. That is not a good idea. If you want to develop such an interpreter you should use a compiled language, like C.
Or is this just an exercide for a class assignment?
Ronald :cool:
10+4*2-6/8
here evaluation order will be
step1-- 4*2
step2-- 6/8
step3-- 10+step1
step4--step3-step2
so accordingly arrange your variables.........
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Himanshu Garg |
last post by:
Hello,
I am using HTML::Parser to extract text from html pages from
http://bbc.co.uk/urdu/
However the encoding of the input text seems to change to some
unknown encoding in the output.
The...
|
by: Vineeth |
last post by:
Hi,
I am using xerces2.6.0 and am developing a program for converting an
xml document to a text file. My program is extending the
DefaultHandler. The first problem I am facing is that even...
|
by: Patrick Gunia |
last post by:
Hi,
i´m trying to build a xml - parser, which should simply list all used
tokens an dattributes including their values. So far, so good, this
works, but now i try to check for illegal phrases in...
|
by: qqcq6s59 |
last post by:
Hi all
I am a newbie and I just saw a ongoing thread on Fileprocessing which
talks abt config parser.
I have writen many pyhton program to parse many kind of text files by
using string module and...
|
by: friend.05 |
last post by:
I have never used xml.
how can I run XML parser?
I am having to file *.xml amd *.phps (xml parser).
But how should I run this files. Do I need any software or not.
By using xml parser I...
|
by: Greg B |
last post by:
Well since getopt() doesn't seem to be compatible with Windows, and
the free implementation of it for Windows that I found still had some
annoying restrictions, I thought I'd whip up a simple...
|
by: mitsura |
last post by:
Hi,
I think I ran into a bug in the XML SAX parser.
part of my program consist of reading a rather large XML file (about
10Mb) containing a few thousand elements.
I have the following...
|
by: (Jamie Andrews) |
last post by:
For a research project, we're looking for a reliable parser for C
that will take an ANSI C program and yield a tree representation of
the program (as a Java or C++ object). Of course a grammar...
|
by: Mike C# |
last post by:
Hi all,
Can anyone recommend a good and *easy to use* lexer and parser generator?
Preferably one that was written specifically for VC++ and not mangled
through 20 different platforms. I've had...
|
by: Just Another Victim of the Ambient Morality |
last post by:
Is pyparsing really a recursive descent parser? I ask this because
there are grammars it can't parse that my recursive descent parser would
parse, should I have written one. For instance:
...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |