Question: 4 EXERCISE - INDIVIDUAL: Create a simple Calculator, Reading Different Numbers of Integers For this exercise, make a program called cs_calculator.c which will scan in

 4 EXERCISE - INDIVIDUAL: Create a simple Calculator, Reading Different Numbers

4 EXERCISE - INDIVIDUAL: Create a simple Calculator, Reading Different Numbers of Integers For this exercise, make a program called cs_calculator.c which will scan in instructions until EoF and prints the output as specified below. An instruction is a sequence of positive integers. The first integer identifies what type the instruction is. If the first number in the instruction is 1, then your program should print out the square of the next number in the instruction. If the first number in the instruction is 2, then your program should print out the value of the next number raised to the power of the number after next. You can assume that the first number in the instruction is only either 1 or 2 You can assume that for each instruction, the correct number of successive positive integers will be given. $ ./cs_calculator Enter instruction: 1 2 Enter instruction: 2 5 3 125 Enter instruction: 1 4 16 Enter instruction: 2 3 4 81 Enter instruction: Ctrl-D $ ./cs_calculator Enter instruction: 2 3 3 27 Enter instruction: 1 10 100 Enter instruction: Ctrl-D Note: The autotest for this exercise expects your program to end WITHOUT a new line character when the user presses Ctrl+D. This means that the command prompt for the next command should be on the same line as the end of your program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!