#Delphi
23 messages · Page 1 of 1 (latest)
while I do not know Pascal/Delhi, it looks like you are iterating something in a file, but in that loop you look in the aarVal array ... also, k is never updated, so it remains 0
ok
since k = 0 all the time, you are looking at the first element of aarVal ... and since I do not really know how the "while Not Eof(file) do" works, I'm not sure if it loops at all
should i change it to a for loop
for k = 1 to 53 do
instead of if
while not Eof(File) do
begin
Readln(File,aarVal) ;
for k = 1 to 53 do
begin
then the If ?
I'm not sure I understand the wanted output, if you want the max value out of an collection of values, you could iterate that array, but it seems you are trying to get these values out of a file, but never reference to it besides the while loop
// this is pseudo code as I do not know delphi
file = open_file("data.txt")
max = 0
while not eof(file) do
begin
value_from_file = read_line(file)
if(value_from_file > max)
max = value_from file
end
maybe you can do something like that, note the line under "begin" that actually gets a line from the file
ok
like this
yes, I guess Readln returns a string or something ? in that case, you need to convert whatever was read to an integer
i have set it to read it as an integer
should work then
ok ill look monday cause not a my computer with delphi but tx for the help
but remember, you have to assign whatever readln() returns to a variable, which you then compare to "max"
np
yup will do
You can just k++ in while loop or do while k < array.size - 1