summaryrefslogtreecommitdiffstats
path: root/4/10.c
diff options
context:
space:
mode:
authorSadeep Madurange <smadurange@users.noreply.github.com>2021-12-18 15:00:09 +0800
committerSadeep Madurange <smadurange@users.noreply.github.com>2021-12-18 15:00:09 +0800
commitdae217441900d5e4960496f28804beb583fc1b1b (patch)
treed179f8ac80f5fe2a6bfb6e1ee20ef834faa87ff0 /4/10.c
parenta0114e7b05bca7100e6120b81aa26815eb1acd2d (diff)
downloadk&r-exercises-dae217441900d5e4960496f28804beb583fc1b1b.tar.gz
4.10
Diffstat (limited to '4/10.c')
-rw-r--r--4/10.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/4/10.c b/4/10.c
index a57effb..769e606 100644
--- a/4/10.c
+++ b/4/10.c
@@ -24,6 +24,15 @@ void clear();
int mgetline();
int getop(char[]);
+/* Reverse Polish notation calculator
+ - single uppercase and lowercase characters are variables (syntax 2 A =);
+ - special variable LOUT for the last printed value.
+ - mathematical functions: sin, cos, tan, exp, pow.
+ - custom functions: swp (swap top 2 values), dup (duplicate last value),
+ top (peek at the stack top), cls (clear stack).
+ - operators: +, -, *, /, % and =
+ - press enter to print the value at the top of the stack.
+ */
int main(int argc, char *argv[]) {
int type, op1, op2;
char s[MAXOP];