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

Username:   Password: 
 RegisterRegister   
 Tables with locate
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
yazdmich




PostPosted: Tue Sep 25, 2012 5:51 pm   Post subject: Tables with locate

What is it you are trying to achieve?
Make a table of outputs with locate


What is the problem you are having?
I don't know how to use locate


Describe what you have tried to solve this problem
I have no idea how to use locate


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


Turing:


const pi := 3.14159265
var height, volume, radius2, surface, height2 : real

put "Volume and Radius of a cone"
put "Variable is radius"
put "Height: " ..
get height
put "First column is radius, second column is height, third column is volume, fourth column is surface area"
for decreasing radius : 20 .. -1 by 1
    radius2 := radius * radius
    height2 := height * height
    volume := (1 / 3) * pi * radius2 * height
    surface := pi * radius * (radius + sqrt (radius2 + height2))
    put radius ..
    put " " ..
    put height ..
    put " " ..
    put volume ..
    put " " ..
    put surface
end for

var radius : real
put "Variable is Height"
put "Radius: " ..
get radius
put "First column is radius, second column is height, third column is volume, fourth column is surface area"
for decreasing height3 : 20 .. -1 by 1
    radius2 := radius * radius
    height2 := height3 * height3
    volume := (1 / 3) * pi * radius2 * height
    surface := pi * radius * (radius + sqrt (radius2 + height2))
    put radius ..
    put " " ..
    put height3 ..
    put " " ..
    put volume ..
    put " " ..
    put surface

end for




Please specify what version of Turing you are using
4.1 school
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Tue Sep 25, 2012 6:07 pm   Post subject: RE:Tables with locate

Have you read the documentation for that function/procedure? locate
yazdmich




PostPosted: Tue Sep 25, 2012 6:27 pm   Post subject: Re: RE:Tables with locate

Zren @ Tue Sep 25, 2012 6:07 pm wrote:
Have you read the documentation for that function/procedure? locate

could I possibly get an example on how to use locate? I just swapped into ICS yesterday so I missed the last 2 weeks and can't find anything regarding locate in the notes the teacher gave me
Zren




PostPosted: Tue Sep 25, 2012 6:40 pm   Post subject: Re: RE:Tables with locate

yazdmich @ Tue Sep 25, 2012 7:27 pm wrote:
Zren @ Tue Sep 25, 2012 6:07 pm wrote:
Have you read the documentation for that function/procedure? locate

could I possibly get an example on how to use locate? I just swapped into ICS yesterday so I missed the last 2 weeks and can't find anything regarding locate in the notes the teacher gave me


The documentation provides an example... Open a new program and run the example there. Though since it uses random, it might be throwing you off. Here's another that's slightly more descriptive.

Turing:

View.Set ("offscreenonly")
for row : 1 .. maxrow
    for col : 1 .. maxcol
        cls

        locate (row, col)
        put "*" ..

        locate (1, 1)
        put "locate(", row, ",", col, ")" ..

        View.Update ()
        delay (20)
    end for
end for
QuantumPhysics




PostPosted: Wed Sep 26, 2012 10:37 pm   Post subject: RE:Tables with locate

Its actually very easy. The run-time screen breaks into a grid of sort. x by y locate(x,y) you simply put the position like you would on a cartesian plane, except the maximum x is 80 (not too sure) an the maximum y is 12 or maxx/maxy
Aange10




PostPosted: Thu Sep 27, 2012 7:56 am   Post subject: RE:Tables with locate

Quote:
Its actually very easy. The run-time screen breaks into a grid of sort. x by y locate(x,y) you simply put the position like you would on a cartesian plane, except the maximum x is 80 (not too sure) an the maximum y is 12 or maxx/maxy


Your really making this all kinds of confusing. I know what it does and how to use it, and your still barely making sense.


locate is very simple. You put the (x,y) coordinates in the parenthesis, and the next put or get statement will be placed there.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: