Saturday, June 4, 2011

A simple calculator

I haven't finished the project yet. Only managed to do the addition function. The rest should be very similar.
I created a procedure called "buttonpressed" to process the numbers each time the buttons are pressed. See screen captures which are self-explanatory.

(A) Defining the global variables













 (B) Calling the "ButtonPressed" procedure each time a number button is pressed:












  (C) The "ButtonPressed" procedure

















(D) Other buttons like the "Plus", "Equal" and "AC" buttons:




2 comments:

  1. Hey can you show more? Im working on a simple calculator myself and im trying to go by your code but you left some parts out. for example whats "operatorsign.text."

    ReplyDelete
  2. The use of "operatorsign.text" is to display a "+" sign when the plus button is pressed. It displays a blank when AC button or Equal button is pressed.

    ReplyDelete