Jump to content

What number is biggest


xdp22
 Share

Recommended Posts

Hello, i need to do function, what return biggest number from file.

In example i got file

test.txt

1
8
101
9
11

So in this file biggest number is 101.

I tried do it :

#include <file.au3>
$e = _FileCountLines("totalne_testy1.txt")
$i=0
 
For $i = 0 To $e
Local $last,$last1
 
 
If FileReadline("totalne_testy1.txt", $i) > $last Then
$last = FileReadline("totalne_testy1.txt", $i)
EndIf
Next
 
MsgBox( 0, "", $last)

But doesn't work :|

Link to comment
Share on other sites

Try this:

#include <Array.au3>
$aNumber = StringSplit(StringStripCR(FileRead("totalne_testy1.txt")), @LF)
For $i = 0 To UBound($aNumber) - 1
    $aNumber[$i] = Number($aNumber[$i])
Next
_ArraySort($aNumber, 1)
MsgBox(0, "Biggest Number", "Biggest number: " & $aNumber[0])

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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