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

Username:   Password: 
 RegisterRegister   
 random numbers placed in data file
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Houdini




PostPosted: Sun May 03, 2009 11:04 am   Post subject: random numbers placed in data file

hi

I'm trying to create a program that will place 15 random integers between the numbers 1 and 40 in a data file using the randint command but im having problems. i get this error " get atempted on incompatible stream number 1.

Turing:

var n : int := 15
var a : array 1 .. n of int
var z : int
var v: int

randomize
for x : 1 .. n
    randint (v, 1, 40)
    a (x) := v
end for

for x : 1 .. n
    open : z, "integer.t", put
    assert z > 0
    get : z, skip
    put : z, a(x)
end for
Sponsor
Sponsor
Sponsor
sponsor
Houdini




PostPosted: Sun May 03, 2009 11:26 am   Post subject: RE:random numbers placed in data file

problem solved.

Turing:
 
var n : int := 15
var a : array 1 .. n of int
var z : int
var v : int

open : z, "integer.t", put
assert z > 0
   
for x : 1 .. n
    randint (v, 1, 40)
    a (x) := v
    put : z, skip
    put : z, a (x)
end for
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: