Computer Science Canada can someone fix this easy program for me |
Author: | MingYang [ Wed Apr 20, 2005 6:36 pm ] |
Post subject: | can someone fix this easy program for me |
Quote: 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!!! |
Author: | Drakain Zeil [ Wed Apr 20, 2005 6:52 pm ] |
Post subject: | |
exit when eof. |
Author: | MingYang [ Wed Apr 20, 2005 7:37 pm ] |
Post subject: | |
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" |
Author: | jamonathin [ Wed Apr 20, 2005 7:42 pm ] | ||
Post subject: | |||
Very beggining of the loop.
|
Author: | MingYang [ Wed Apr 20, 2005 7:50 pm ] |
Post subject: | |
please help!!! Quote: 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 |
Author: | MingYang [ Wed Apr 20, 2005 7:55 pm ] |
Post subject: | |
I fixed it thanks guy!@!@!@ THANK YOU VERY MUCH!@!@!@ Quote: 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 |
Author: | Cervantes [ Wed Apr 20, 2005 7:55 pm ] |
Post subject: | |
Wrong loop. It goes in the last one. EDIT: woohoo!! |