Recent

Author Topic: More complicated Calculator V.2  (Read 3393 times)

Rexpiger

  • Newbie
  • Posts: 5
More complicated Calculator V.2
« on: May 24, 2018, 12:15:41 am »
Hello all, I have built a calculator but it can only take two numbered i.e x+y

I would like to make one where you can input whatever you want I.e
X+y-a/d.

But I have no idea where to start, I wanted to take the string the user inputs and convert it to a integer so I can simply calculate what they enter but that of course just returns the error “invalid integer”
Any help is greatly appreciated!!Thanks in advance to anyone who helps me out!!

Someone suggested using TFPExpressionParser but after going through the documentation, I still don't understand how i would go about using this with lazarus ide to make a claulator.Could someone help me out?
« Last Edit: May 26, 2018, 06:08:35 pm by Rexpiger »

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: More complicated Calculator
« Reply #1 on: May 24, 2018, 12:19:58 am »
But I have no idea where to start, I wanted to take the string the user inputs and convert it to a integer so I can simply calculate what they enter but that of course just returns the error “invalid integer”

http://wiki.lazarus.freepascal.org/How_To_Use_TFPExpressionParser

Rexpiger

  • Newbie
  • Posts: 5
Re: More complicated Calculator
« Reply #2 on: May 24, 2018, 04:58:34 pm »
Thanks, I’ll have a look into the it.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: More complicated Calculator
« Reply #3 on: May 24, 2018, 05:19:41 pm »
Or the examples/demos of the "symbolic" pacakge

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: More complicated Calculator
« Reply #4 on: May 24, 2018, 05:28:30 pm »
If you will create something even better and more user-freindly than http://www.speedcrunch.org/ I'll be happy user. SpeedCrunch is the best calculator I met on PCs.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Handoko

  • Hero Member
  • *****
  • Posts: 5122
  • My goal: build my own game engine using Lazarus
Re: More complicated Calculator
« Reply #5 on: May 24, 2018, 06:43:01 pm »
SpeedCrunch is the best calculator I met on PCs.

Agree, I use SpeedCrunch too.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: More complicated Calculator
« Reply #6 on: May 24, 2018, 06:49:36 pm »
x48 is also quite nice.

zamtmn

  • Hero Member
  • *****
  • Posts: 593
Re: More complicated Calculator
« Reply #7 on: May 24, 2018, 07:46:35 pm »
If you will create something even better and more user-freindly than http://www.speedcrunch.org/ I'll be happy user. SpeedCrunch is the best calculator I met on PCs.
I use nlcalc (only windows, closed source,no longer develops) - show and hide by numlock press, this is really convenient

glorfin

  • Full Member
  • ***
  • Posts: 148
  • LMath supporter
Re: More complicated Calculator
« Reply #8 on: May 24, 2018, 08:04:56 pm »
Look at the uEval unit of LMath library: https://sourceforge.net/projects/lmath-library/
And at the Eval console calculator as example of its use: https://sourceforge.net/projects/eval-command-line-calculator/?source=navbar
 

 

TinyPortal © 2005-2018