Please provide some ecplanation to your answe, thank you. 1. Write down the post
ID: 638853 • Letter: P
Question
Please provide some ecplanation to your answe, thank you.
1. Write down the postfix notation for the following expression (4 Points.)
y = x2 + x
2. Write down HP-15C calculator program for evaluating the above expression (4 Points.)
HINT: A HP-15C calculator programming for calculating the expression (x(x - 5)) is
sto 0
rcl 0
rcl 0
5
-
*
g rtn
3. (4 Points.) State how you would type arguments h, o, w, n, o, w to the macro cat, define(cat, $1$2$3$4$5$6$7$8$9) so that the printed result was
how now
4. Write down a macro definition that concatenates given two strings in reverse and place
Explanation / Answer
1)y = x2 + x
yx2=x+
4)
Individual tokens in single line macros can be concatenated, to produce longer tokens for later processing. This can be useful if there are several similar macros that perform similar functions.
Please note that a space is required after %+, in order to disambiguate it from the syntax %+1 used in multiline macros.
As an example, consider the following:
Now, if we need to access the elements of tBIOSDA in different places, we can end up with:
This will become pretty ugly (and tedious) if used in many places, and can be reduced in size significantly by using the following macro:
Now the above code can be written as:
Using this feature, we can simplify references to a lot of macros (and, in turn, reduce typing errors).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.