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.
That Man
0
Newbie Poster
Recommended Answers
Jump to PostDon'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:
select …
Jump to Postyou 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
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
That Man
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
dwks
149
Posting Whiz in Training
shaikh_mshariq
2
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.