2 Replies - 15547 Views - Last Post: 06 January 2008 - 04:39 AM Rate Topic: -----

#1 baban  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 3
  • Joined: 05-January 08

How to make a calculator program using functions?

Post icon  Posted 05 January 2008 - 11:37 PM

How can I make a calculator using functions??
Is This A Good Question/Topic? 0
  • +

Replies To: How to make a calculator program using functions?

#2 Louisda16th  Icon User is offline

  • dream.in.assembly.code
  • member icon

Reputation: 15
  • View blog
  • Posts: 1,967
  • Joined: 03-August 06

Re: How to make a calculator program using functions?

Posted 06 January 2008 - 12:00 AM

You'll have to show your code if you want someone to help you.
In case you don't know how to code the program, this should help get you started:
Write four functions: One for each arithmetic operation. The functions should each accept to arguments - the operands and return the result.
Ask the user to input two numbers and the operator in your main function.
Check what operator the user enters and call the appropriate function. You can use an if-else construct or a switch case construct (the latter would be better).
Output the answer in the main function itself.

Hope this helps :).
Was This Post Helpful? 0
  • +
  • -

#3 baban  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 3
  • Joined: 05-January 08

Re: How to make a calculator program using functions?

Posted 06 January 2008 - 04:39 AM

View Postbaban, on 5 Jan, 2008 - 11:37 PM, said:

How can I make a calculator using functions??



Tnx... :-)
Was This Post Helpful? 1

Page 1 of 1