Hi
I'm doing question 2 from http://olympiad.org.uk/papers/2006/bio/bio06-exam.pdf (Out of personal interest)
How can I write a program that can handle the brackets? I suppose a more general view would be:
a+b*c/d
I can easily write a program that does ((a+b)*c)/d that goes from left to right.
However, how could could I do a+((b*c)/d) that takes into account operator presedence (annoyingly my £5 calculator can do this, although I can't).
If I wrote in brackets e.g.
(a+b)*(c+d)
how could I write a program that knows which operations to do first?
Thanks!