Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program for a Calculator that can do three operations, +, , and x. This calculator should be able to add, subtract, and multiply

Write a program for a Calculator that can do three operations, +, , and x. This calculator should be able to add, subtract, and multiply two numbers of any size. The following is the sequence of steps that your program should follow:

Ask user to enter the first number.

Your program should get this number from the user.

Ask user to enter the second number.

Your program should get this number from the user.

Ask user whether the user wants addition, subtraction, or multiplication. User will enter +, -, *.

Your program should perform the operation whatever user entered above.

Finally, your program should show the result in the output screen.

Now, in order to implement this calculator program, you need to remember the following:

Take the first number from the user and store that number in a linked list. Lets say the first linked list has head named num1.

Take the second number from the user and store it in another linked list. Lets say the second linked list has head named num2.

Remember that the user may enter a number of any size. Your program should keep on taking the input number until user hits the Enter key. As soon as the user hits Enter key, your program should know that the user is done entering the first number. Now your program should repeat this process and take second number from the user.

If the user enters the following number: 45683450976535456 and hits Enter, it means your code should create the first linked list of 17 nodes because there are 17 digits in the abovementioned number. Similarly your program will create another linked list of n nodes where n is the number of digits in the second number.

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_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Mobilize your audiences into action through social media messages.

Answered: 1 week ago