i m doing a calculator. i designed the screen, now i developing event functions. i get the buttons value and set to label now. but i dont now how can i well write a calculator? please give me feedback.
My source Code;https://github.com/nesetaydinn/lvglanaloguedialdesing/blob/master/tos_page_calculator.c
please specify the problem. What do you mean with “how to write”?
where are the problems?
what is unclear to you?
Could you provide an image of your progress?
i want develop a calculator with stacks but how can use stack with events?
i developed a functional calculator before on qt but there i used switch. I now want a develop with stacks how can use button events with stacks. I didn’t before calculator with stacks so i dont design to algorithm
The main view of calculator;
i now take numbers and set label and get label and set a float variables;
and i delete numbers with “sil” button;
how can i do math operations?
I’m not sure if this is on-topic for the LittlevGL forum. We provide the GUI itself, but I would think that how you design the calculator logic is GUI-independent. Unless I’m missing something?
Step 1: On mulitply operation button press: save typed number and set operation flag to MULTIPLICATION
Step 2: type another number
Step 3: on evaluate button press: save other typed number, call evaluate(x1,x2,OPERATION), set label to the return value.
For math operations use math.h
If you want to use a stack. consult stackoverflow for a c implementation