Jump to content

A calculator


Rad
 Share

Recommended Posts

Yeah... Im not really sure what to do and this is really buggin me because its just a calculator... It looks like this:

[C][/][*][-]

[7][8][9][+]

[4][5][6][+]

[1][2][3][E]

[ 0 ][. ][E]

Theres a little colum to the right that lists previous equations too

You type some stuff, add it, hit enter and it puts the string just fine: 126+32

But how do you solve that as a string? :P

I can manage sepering each equation, but I dont get how to solve the string... theres gotta be a function that does it, but I dont really know what to search for. I doubt theres a StringSolveEquation($sEquation) function...

calculator.bmp

Edited by Rad
Link to comment
Share on other sites

Yeah... Im not really sure what to do and this is really buggin me because its just a calculator... It looks like this:

[C][/][*][-]

[7][8][9][+]

[4][5][6][+]

[1][2][3][E]

[ 0 ][. ][E]

Theres a little colum to the right that lists previous equations too

You type some stuff, add it, hit enter and it puts the string just fine: 126+32

But how do you solve that as a string? :nuke:

I can manage sepering each equation, but I dont get how to solve the string... theres gotta be a function that does it, but I dont really know what to search for. I doubt theres a StringSolveEquation($sEquation) function...

I'm not on a Windows box, so can't verify at the moment, but I don't think AutoIT is as picky as some languages about variable types in arithmetic operations. You can use Number() to convert the string "123" to the number 123, but I think AutoIT might give the same result for both:

$x = "123" + "456"

$x = 123 + 456

There's some fancy college-boy computers 101 term for that like "non-srict variable typing" or some such, but I'm not a college boy... :P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Number()....

...

omg

LOL ok thanks that will probrably work, wow I feel so stupid right now... I need sleep

cept if i go to sleep ill sleep to long n thats not good so im staying up all night lol

Link to comment
Share on other sites

Eval() is wierd... I dont understand it at all...

Dim $a_b = 12

$s = Eval("a" & "_" & "b") ; $s is set to 12

?... It doesnt add anything either:

$a = "5+12"

$s = Eval("a")

msgbox(0,"",$s)

returns 5+12

As for the Number() thing, Im gonna have to redo the entire calculator lol... :P

Omg...

Look at number example:

$w = Number(1+2+10);returns 13
$x = Number("3.14");returns 3.14
$y = Number("24/7");returns 24
$z = Number("tmp3");returns 0

How can you make a string into a regular ... text...?

Edited by Rad
Link to comment
Share on other sites

:P

Execute? I never would have thought that...

SlimShady YOU ARE THE MAN!

Grampa said "Learn something new every day."

Execute()

Cool! I'm done for day!

:-)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

:P works like a charm!! thanks again u saved me alot of tweaking slim

Grampa said "Learn something new every day."

haha its 6am I guess I shouldnt look forward to learning anything else today now huh :nuke:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...