05-03-2021 09:24 PM
HI!
So I've made a basic calculator. But I'm having a problem implementing the decimal point right. Everything works when done properly but it's not the way it's supposed to traditionally work. So when I put the first operand (like 😎 then I click the decimal point, it turns the 8 into (0.8). The only way it works is first inputting your floating-point number (9.78) by inputting 978 then click the decimal point twice. Which in turn spits out 9.78. After that, you're okay to do anything else. So I was wondering what I can do to fix it. Please respond as soon as possible.
05-03-2021 10:24 PM
In a real calculator, hitting the decimal point doesn't divide anything by 10 like you do in your VI. It basically sets a flag that everything after that will be divided by 10.
I would not do any math on the number as you enter it. I would treat the number as a string where you append each digit and the decimal point. Keep track that you've entered the decimal point so you can't enter it twice. Once you go and hit an operator, then turn that string into a numeric value and do the math on that.
Search the forums. A number of people have attempted calculators over the years that will give you ideas.
05-04-2021 10:43 AM
Okay, thank you! Ill give it a try! If I cant figure it out ill ask more questions!