Programming Fundamentals

For this exercise, make a program called cs_calculator.c which will scan in instructions until End-Of-Input (which we enter to our terminal with the keyboard shortcut CTRL-D) and prints the output as specified below. An instruction is a character, followed by one or two positive integers.

The first character identifies what type the instruction is.

Examples

dcc cs_calculator.c -o cs_calculator
./cs_calculator
Enter instruction: s 2
4
Enter instruction: p 5 3
125
Enter instruction: s 4
16
Enter instruction: p 3 4
81
Enter instruction: 
./cs_calculator
Enter instruction: p 3 3
27
Enter instruction: s 10
100
Enter instruction: 

One major challenge of this exercise is figuring out how to use scanf effectively. The lessons you learn in this exercise regarding scanf will be useful in assignment 1!

Assumptions/Restrictions/Clarifications