summaryrefslogtreecommitdiffstats
path: root/4/4.c
diff options
context:
space:
mode:
Diffstat (limited to '4/4.c')
-rw-r--r--4/4.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/4/4.c b/4/4.c
index 5333ba3..ccea5e8 100644
--- a/4/4.c
+++ b/4/4.c
@@ -32,7 +32,7 @@ double peek();
* (swap top two stack positions), d (clear stack) */
int main(int argc, char *argv[]) {
int type;
- double op2;
+ double op2, op1;
char s[MAXOP];
while ((type = getop(s)) != EOF) {
@@ -70,6 +70,12 @@ int main(int argc, char *argv[]) {
case 'c':
push(peek());
break;
+ case 's':
+ op2 = pop();
+ op1 = pop();
+ push(op2);
+ push(op1);
+ break;
case '\n':
printf("\t%.8g\n", pop());
break;