Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago