Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Perform Operations (20 marks) Write a C program to implement calculator using pointers. You should ask the user two operands and what kind

3. Perform Operations (20 marks) Write a C program to implement calculator using pointers. You should ask theSample run: Enter the operation you want to perform('+' for Addition,'' for Subtraction,'*' for

3. Perform Operations (20 marks) Write a C program to implement calculator using pointers. You should ask the user two operands and what kind of arithmetic operation the user wants to run on them. This shouldn't be just a onetime operation, the user should be able to input the operands and the kind of operation which it wants to be performed on them as long as he wants to. Users may enter 'Q' to quit the program. You need to write separate function for all the operations (+,-, *, /). In these functions you need to pass the variables as pointers and then perform the requested operation and return the result. To calculate the result, you should not use a third variable. For example: Consider the function int sum(int *a, int *b); Here, the addition of two numbers must be stored in 'a' and returned. Implementation Details: */ Function: addition, subtraction, multiplication, division Perform operations on two integers using pointers. Parameters: a: Pointer to the first integer. b: Pointer to the second integer. Returns: void void addition(int *a, int*b); void subtraction(int *a, int*b); void division (int *a, int*b); void multiplication (int *a, int*b); Sample run: Enter the operation you want to perform('+' for Addition,'-' for Subtraction,'*' for Multiplication, '/' for Division, Q to quit): + Enter the operands for this operation : 78 Addition of 7 and 8 = 15 Enter the operation you want to perform('+' for Addition,'-' for Subtraction,'*' for Multiplication, '/' for Division, Q to quit): - Enter the operands for this operation: 109 9 Subtraction of 109 and 9 = 100 Enter the operation you want to perform('+' for Addition,'-' for Subtraction,'*' for Multiplication, '/' for Division, Q to quit): Q Goodbye!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Here is a C program that implements a calculator using pointers for addition subtraction multiplicat... 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

Step: 3

blur-text-image

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

Systems Analysis And Design

Authors: Alan Dennis, Barbara Wixom, Roberta M. Roth

7th Edition

1119496489, 978-1119496489

More Books

Students also viewed these Programming questions

Question

What are the key elements of the system proposal?

Answered: 1 week ago