Calculator code

Hello, I am starting in this world, I need help with the code of a calculator, the truth is that I still do not have the necessary knowledge to be able to carry it out, I wanted to see if someone could help me, thanks and regards

1 Like

Do you want to use it via keyboard or with mouse?

Do you plan to have a graphic of the buttons of the calculator?

You can find more here: Reference / Processing.org

And examples: Examples / Processing.org

1 Like

What code do you have so far? Do you have setup() and draw() functions?

Can you draw buttons using fill(), stroke(), rect(), and text()?

Do you have a mousePressed() function? Does it check the mouse’s position for things?

We really need to see some code to be able to help you. Please attempt some, and post your attempt.

1 Like

You need

  • a “display” rect() with the number
  • the buttons (1,2,… + , -, =… )
  • and a concept: what’s happening

what’s happening:

  • you type number (number 1), display it, add new input at the end of number (meaning when you have 4 and type 3, you get 43)
  • You type +,- etc…: Number is hidden, but you store the number and the function (+ or - or / …)
  • You type, the 2nd number gets displayed…
  • and so forth…