Computer Science Canada

records

Author:  Clayton [ Wed Jan 25, 2006 3:38 pm ]
Post subject:  records

i asked my teacher about records and he couldnt tell me anything about them, i looked in the turing directory and found it confusing, ditto with the online tutorials can ne1 plz help explain them too me

Author:  person [ Wed Jan 25, 2006 3:47 pm ]
Post subject: 

http://www.compsci.ca/v2/viewtopic.php?t=9636

a record is a basically a user defined type, this means we are no longer restricted to things like ints and strings

i know wat im saying is basically wat the tutorial above said, but can u post wat u dont get about it?

Author:  Clayton [ Wed Jan 25, 2006 3:51 pm ]
Post subject: 

i basically dont understand how i can use them and how to use them

Author:  Delos [ Wed Jan 25, 2006 3:54 pm ]
Post subject: 

And hence you read that Tut, which, I might add, is one of the best tuts around. It'll have you compacting your code in no time.

Author:  Clayton [ Wed Jan 25, 2006 3:58 pm ]
Post subject: 

Delos wrote:
And hence you read that Tut, which, I might add, is one of the best tuts around. It'll have you compacting your code in no time.

did you not read my message, i didnt understand the tut, so i need some1 to explain it to me in other terms

Author:  person [ Wed Jan 25, 2006 5:19 pm ]
Post subject: 

SuperFreak82 wrote:
did you not read my message, i didnt understand the tut, so i need some1 to explain it to me in other terms


did you not read my message, wat didnt u understand about it?

Author:  MysticVegeta [ Wed Jan 25, 2006 6:09 pm ]
Post subject: 

person wrote:

did you not read my message, wat didnt u understand about it?

did you not read his message?
SuperFreak82 wrote:
i basically dont understand how i can use them and how to use them

Author:  person [ Wed Jan 25, 2006 6:12 pm ]
Post subject: 

do u not understand that its a pretty vague thing to say, and the tut explains all that

Author:  Andy [ Wed Jan 25, 2006 6:13 pm ]
Post subject: 

http://www.compsci.ca/v2/viewtopic.php?t=2325 there's another tutorial..

Author:  Clayton [ Thu Jan 26, 2006 12:21 am ]
Post subject: 

thank you that helps me alot i didnt see that there b4 thnx again

Author:  iker [ Thu Jan 26, 2006 4:49 pm ]
Post subject: 

Also, you can write a record as a whole to a file, instead of every single variable, and save many lines...

so for example instead of
code:

var x, y, z : int
x := 9
y := 10
z := 15
var a, b, c : string
a := "a"
b := "b"
c := "c"
var fileNo : int
open : fileNo, "filename.txt", write
write : fileNo, x
write : fileNo, y
write : fileNo, z
write : fileNo, a
write : fileNo, b
write : fileNo, c
close : fileNo

you can have
code:

type ter :
    record
        x : int
        y : int
        z : int
        a : string
        b : string
        c : string
    end record
var let : ter
let.x := 9
let.y := 10
let.z := 15
let.a := "a"
let.b := "b"
let.c := "c"
var fileNo : int
open : fileNo, "filename.txt, write
write : fileNo, let
close : fileNo

now, even though there are 3 more lines with a record, you don't have to risk forgetting to write one of the variables since all of them are included in writeing a record

Author:  Clayton [ Thu Jan 26, 2006 10:35 pm ]
Post subject: 

ok thnx i think im starting to understand now


: