Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 can someone fix this easy program for me
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
MingYang




PostPosted: 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!!!
Sponsor
Sponsor
Sponsor
sponsor
Drakain Zeil




PostPosted: Wed Apr 20, 2005 6:52 pm   Post subject: (No subject)

exit when eof.
MingYang




PostPosted: Wed Apr 20, 2005 7:37 pm   Post subject: (No 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"
jamonathin




PostPosted: Wed Apr 20, 2005 7:42 pm   Post subject: (No subject)

Very beggining of the loop.
code:

loop
   exit when eof
   . . . blah blah fart
end loop
MingYang




PostPosted: Wed Apr 20, 2005 7:50 pm   Post subject: (No 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
MingYang




PostPosted: Wed Apr 20, 2005 7:55 pm   Post subject: (No 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
Cervantes




PostPosted: Wed Apr 20, 2005 7:55 pm   Post subject: (No subject)

Wrong loop. Wink It goes in the last one.
EDIT: woohoo!!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: