ChrisL Posted August 16, 2007 Posted August 16, 2007 A CD can hold upto 200 images I need to know what formula to use to work out the quantity of CD's If $images = 0 then there would be 0 CD If $images = 12 then there would be 1 CD If $images =201 then there would be 2 CD's I have this $images = 12 $maxCD = 200 Msgbox(0,"",Int($images/$maxCD +1)) Which works fine except for $images = 0 because you still get 1 cd. Am I better changing the code so that if $images = 0 then $CD = 0 or is there a better way $images = 12 $maxCD = 200 If $images > 0 then $CD = Int($images/$maxCD +1) Else $CD = 0 EndIf Just need someone to confirm I'm right or an Arse (Note If replying Arse then the reply must be justified ) [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
PsaltyDS Posted August 16, 2007 Posted August 16, 2007 That was fun... $maxCD = 200 While 1 $images = InputBox("CD Count", "How many images?") If @error Then Exit $CDs = Int($images / $maxCD) If Mod($images, $maxCD) Then $CDs += 1 MsgBox(64, "Results", "At " & $maxCD & " images per CD, it will take " & $CDs & " CDs to hold " & $images & " images.") WEnd 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
the_lord_mephy Posted August 16, 2007 Posted August 16, 2007 (edited) Take a look at the Ceiling function Edit: well if you're give him code i'll do it too $images = 12 $maxCD = 200 Msgbox(0,"",Ceiling($images/$maxCD)) Edited August 16, 2007 by the_lord_mephy My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
PsaltyDS Posted August 16, 2007 Posted August 16, 2007 Take a look at the Ceiling function Edit: well if you're give him code i'll do it too $images = 12 $maxCD = 200 Msgbox(0,"",Ceiling($images/$maxCD)) Ooh... I like! Never noticed that function before and had to go look it up! 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
ChrisL Posted August 16, 2007 Author Posted August 16, 2007 Thanks both Never heard of Ceiling() before. [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now