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

Username:   Password: 
 RegisterRegister   
 Data files
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
anna12345




PostPosted: Wed Apr 16, 2008 10:23 am   Post subject: Data files

I don't understand how data files work . I've read the tutorial but I still don't get it. How do you create a new file and then open it. For example I need to create a program that records your score. So you can see your score after. Can someone explain how to do a program like that? I'm extremely confused

Here's the code

type high_type:

record
street:string(7)
name:string
score:int
end record

var high: array 1..5 of high_type
for i:1..5
high(i). street:= "Laurier"
high(i). name:= "Anna"
high(i). score:=100
end for

var f1:int
open:f1, "Read Data", write
for i:1..5
write: f1, high(i)
end for
close: f1

open : f1, "Reid_Data", read
for i : 1 .. 5
read : f1, high (i)
end for
close :f1
Sponsor
Sponsor
Sponsor
sponsor
BigBear




PostPosted: Mon Apr 21, 2008 5:41 pm   Post subject: Re: Data files

When you use open: filenumber, filename, put you create the file and can now put information in it.
then you put :fn , name - 1200
and it will record the score. then you just read the ile and put it on the screen to view text files.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: