
-----------------------------------
MingYang
Wed Apr 20, 2005 6:36 pm

can someone fix this easy program for me
-----------------------------------
var aud, fileno : int
var name : string
var tot, c : int := 0

open : fileno, "a:/tvshow", put
loop
    put "Please enter the TV show name"
    get name : *
    put : fileno, name
    put "Please enter the audience voted for this show"
    get aud
    put : fileno, aud
    tot := tot + aud
    exit when tot = 2300

end loop
close : fileno

cls

open : fileno, "a:/tvshow", get

put "TV SHOW", "" : 16, "Audiences"

loop
    get : fileno, name : *
    get : fileno, aud
    tot := tot + aud
    exit when tot = 2300
    put name, "" : 20, aud
end loop
close : fileno


the program works but it shows error called "Attempt to read past eof"

other than that everything is fine

the program is to get audiences for each TV show until 2300 audience votes

and i MUST use loop


thanks in advance!!!

-----------------------------------
Drakain Zeil
Wed Apr 20, 2005 6:52 pm


-----------------------------------
exit when eof.

-----------------------------------
MingYang
Wed Apr 20, 2005 7:37 pm


-----------------------------------
please tell me where i put that!!

i tried many places but no lucky

edit: i think you were helping me with the new command (exit when eof)and the user puts the number of audiences, but tahts not my problem

the problem is that it shows the stupid error "Attempt to read past eof"

-----------------------------------
jamonathin
Wed Apr 20, 2005 7:42 pm


-----------------------------------
Very beggining of the loop.

loop
   exit when eof
   . . . blah blah fart
end loop

-----------------------------------
MingYang
Wed Apr 20, 2005 7:50 pm


-----------------------------------
please help!!!

var aud, fileno : int
var name : string
var tot, c : int := 0

open : fileno, "a:/tvshow", put
loop
    exit when eof
    put "Please enter the TV show name"
    get name : *
    put : fileno, name
    put "Please enter the audience voted for this show"
    get aud
    put : fileno, aud
end loop


close : fileno

cls

open : fileno, "a:/tvshow", get

put "TV SHOW", "" : 16, "Audiences"

loop
    get : fileno, name : *
    get : fileno, aud
    put name, "" : 20, aud
end loop
close : fileno


-----------------------------------
MingYang
Wed Apr 20, 2005 7:55 pm


-----------------------------------
I fixed it thanks guy!@!@!@

THANK YOU VERY MUCH!@!@!@
var aud, fileno : int
var name : string
var tot, c : int := 0

open : fileno, "a:/tvshow", put
loop
    put "Please enter the TV show name"
    get name : *
    put : fileno, name
    put "Please enter the audience voted for this show"
    get aud
    put : fileno, aud
    tot := tot + aud
    exit when tot = 2300
end loop


close : fileno

cls

open : fileno, "a:/tvshow", get

put "TV SHOW", "" : 16, "Audiences"

loop
    exit when eof (fileno)
    get : fileno, name : *
    get : fileno, aud
    put name, "" : 20, aud
end loop
close : fileno


-----------------------------------
Cervantes
Wed Apr 20, 2005 7:55 pm


-----------------------------------
Wrong loop.  :wink:  It goes in the last one.
EDIT:  woohoo!!
