Jump to content

how to return biggest number?


Recommended Posts

  • Moderators

I want make programm that return biggest number (user inserts 3 numbers)

Where's your effort?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

what is effort?

Show what you have attempted to make work thus far...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

what is effort?

You know, some people think SmOke_N got his nym from the charred smoking craters he likes to leave behind after a retort like that...

Thanks for the great belly laugh, though!

:)

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

Hi.

I assume that you might have no clue how to start at all.

1.) read the FAQ (in this forum the topmost, sticky postings)

2.) Get the latest versions of Autoit3 and the Autoit3 customized SciTe Editor (main page, -> download)

3.) read through the help file of Autoit3

4.) for your main question the lines below should give you a start, ....

5.) ... now try hard to solve it on your own

6.) search the forum for similar questions

7.) try hard again :)

...

10.) When asking a question, post the code you wrote so far :D, put your code between an [autoit] on top and [/autoit] at the end of your code to make it easy readable (syntax highlighting)

Some simple example to give you a start:

$MyNumbers="1,39,3,5,42,6,10,2,12,17,22" 
; to write a function to concatenate user inputs use the  [b]&[/b] character: 
$MyNumbers = $MyNumbers & "," & $UserInput

; now split it into an array, as there is an easy sorting function for arrays :)
$MyArray=StringSplit($MyNumbers,",")

; then have a look at _ArraySort() function. (help file! Keep in mind that you will have to include the array.au3, see example in help)

You'll see that after your sort "42" is THE ANSWER. Now try and find your correct question ;)

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

  • Developers

I assume that you might have no clue how to start at all.

He should slowly have a clue by now seeing how often a question was asked. There is really no problem with asking questions but its normal to first try it yourself and learn in stead of just dumping each question in the forum assuming somebody will code it for you.

:)

Edited by Jos
grammer

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

He should slowly have a clue by now seeing how often a question was asked.

Basically that's what I wanted to express. And: My answer is a TXT snippet I wrote to use it again later on for those posters with just very few posts, those, who definitely really just have trouble with their first steps :(

... and I didn't want to waste my time to write a 2nd one for this particular one :cheer: I used the "friendly" one :cheer: can you forgive me :cheer: ??

There is really now problem with asking questions but its normal to first try it yourself and learn in stead of just dumping each question in the forum assuming somebody will code it for you.

Well, some questions guarantee for topic close within very few minutes. E.g. this "decompile" thing.

I still believe this should be added to the FAQ section,

1.) as an entry "No more decompile! This is fact - don't even think of asking for it!!"

2.) the workaround with FileInstall() and $CmdLine[0] as a "Password check" might be helpful for others.

Regards, Rudi.

PS:

After I got my :):D;) I went through all the decompile related topics upto the date it was removed. Well, :cheer: imho they were all just "IT IS REMOVED, DON'T ASK FOR IT!!". I feel this not to be really friendly ...

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

  • Developers

I feel this not to be really friendly ...

Its simple: The decompiler was hacked so support is stopped.

Anyway: I my humble opinion you should ensure proper backups and versioning for your source and not depend on a decompiler.

I you want you can include the source in 2 ways yourself: as you mentioned use fileinstall or use the #AutoIt3Wrapper directive which will store a copy in the programs resources.

- end of thread hijack :) -

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

or just without _arraysort:

MsgBox(0,"blabla",Highest(2,8,6))
  
  Func Highest($Var1, $Var2, $var3)
      $Highest = 0
      For $i = 1 to 3
          $Var = Execute("$Var"& $i)
          if $Var > $Highest Then $Highest = $Var
      Next
      
      Return $Highest
      
  EndFunc
Edited by kip
Link to comment
Share on other sites

Hi.

- end of thread hijack :) -

Ehh, I'm a hijacker ;)

BTW: Did you know that terror phobic people should always have a bomb in their luggage when traveling by plane? It's definitely much safer this way:

The propability, that there are TWO bombs on one plane is that small .... :D

Regards, Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

  • 8 years later...
On 3/15/2008 at 3:24 PM, Kip said:

or just without _arraysort:

 

(I know I'm pulling an old topic back up, but replying to it here seemed like the best option)

Kip's code taught me some interesting things and I expanded upon it with some input boxes for a thing I'm working on.
Right now I don't know an easy way to add an "how many columns do you have?" option, so that's still manual editing (for now).

#include <MsgBoxConstants.au3>

Call ("HighestImput")
MsgBox(0,"MsgBox",$Highest)


Func HighestImput()
    $Number1 = InputBox("Set length of columns", "Please fill in the length of the 1st column below")
    $Number2 = InputBox("Set length of columns", "Please fill in the length of the 2nd column below")
    $Number3 = InputBox("Set length of columns", "Please fill in the length of the 3rd column below")
    $Number4 = InputBox("Set length of columns", "Please fill in the length of the 4th column below")

    global $Highest = 0
    For $i = 1 to 4
        $Var = Execute("$Number"& $i)
        if $Var > $Highest Then $Highest = $Var
    Next
EndFunc

 

Link to comment
Share on other sites

  • Moderators
20 minutes ago, Oniguro said:
On 3/15/2008 at 10:24 AM, Kip said:

replying to it here seemed like the best option)

@Oniguro - Incorrect, necro-posting in an 8 year old thread is rarely, if ever, the best option. Better to start your own thread and link to this one if absolutely necessary.

 

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...