Any ideas on how to do this program because I have the slightest idea. This is what I have to do, Multi-Function Calculator - Ask the user for 2 numbers, then ask them to select from a numbered list of operations. As rudimentry error checking, give them an extra chance if they enter an invalid value. Depending on the operator selected (+, -, *, and /) do the operation on the numbers and print out the result including the equation with the proper operator. Remember to check for situations such as division by zero. You'll have to use floating-point numbers here as well.
Jump to Post
Don't get too overwhelmed -- this is just a simple console program. Begin with the simplest program you can think of then gradually add more code to make it do what the requirements state. Don't attempt to implement everything all at one time. Here are a couple hints:
Jump to Post
you will want to use floats --
float value1, value2, answer; value1 = 1 value2 = 2 // divide operator answer = value1 / value2; // // multipication operator answer = value1 * value2; // etc
as for the switch -- I already posted a brief example. …
All 5 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.