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

Username:   Password: 
 RegisterRegister   
 In Need Of Help ... badly
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Quality




PostPosted: Wed Mar 10, 2004 7:46 pm   Post subject: In Need Of Help ... badly

hey ...

im a grade 9 student just learning turing and im haveing trouble with the concept of arrays

can anyone help me???
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Wed Mar 10, 2004 7:50 pm   Post subject: (No subject)

well learning arrays in Grade 9 is crazy. Are you taking a double credit course that is gr 9 business studies and gr 10 computer science?
Either way, arrays are learned in the grade 11 year of computer science. there are a lot easier things to learn before arrays.
What have you learned so far?
Quality




PostPosted: Wed Mar 10, 2004 7:56 pm   Post subject: (No subject)

nothing really ...

ive got a few friends in grade 11 and im good friends with oen of teh computer teachers at my school ... theyre showing me programs with arrays and i was thinking that icould use them in my latest assignemnt

the assignemtn is teh same oen that hailchad posted .. he goes to my school ... i dont rele liek him ... unlike him im not trying to get people to do my work for me .. im trying to get help

one of my friends in grade 11 told me that when i draw my snow i should use an array ... but i dont know how to .. thats the problem ... so if you could show me a few programs with arrays in tehm so i understand them it sould be GREATLY appricated
zylum




PostPosted: Wed Mar 10, 2004 7:58 pm   Post subject: (No subject)

lol, i learned arrays in my first year (grade 10) it's not like its a difficult concept... anyways, check out this tut for help http://www.compsci.ca/v2/viewtopic.php?t=1117

-zylum
jonos




PostPosted: Wed Mar 10, 2004 7:58 pm   Post subject: (No subject)

right...im in the middle of typeing something and zylum just marches past in front of me in the line...damn

alright, you could go to turing tutorials (on these message boards) and there will be a tutorial there near the top (as of today or yesterday I think). or you could try to understand this:

an array is like a group of variables that are similar or to be used for similar things (usually). think of them like this:

[][][][][]

that is an array of 5 elements in it or 5 slots of data if you will.
note: this is only visual, to help you visualize what it is.
if you wanted to put "jonos" in the first element of the array, you could visualize it as:
[jonos][][][][]
and if you wanted to put "jonos" in element 2 and "cervantes" in element 5, it might be visualized as:
[][jonos][][][cervantes]

to declare an array in turing:

var arrayName : array startingnumber..endingnumber of string/int/real/ (and maybe be boolean, but don't worry about that yet)

so for an array named rents, with 5 elements, it would look like:
var rents : array 1..5 of real

now to access these just do it as if you wanted to access a character of a string

arrayName(element#)

so if we take:
[][jonos][][][cervantes] %this array is named "names"
(just to visualize)

and if we wanted to put cervantes name to the screen, you would go:

put names(5)

and you would get cervantes on the screen.

similarly to put data into an array element, you would just use:

get names(2)

and anything added would erase "jonos"

hope that helped, im not too good at explaining things all the time, but my teacher taught these really well in gr. 10.[/b]
Quality




PostPosted: Wed Mar 10, 2004 8:06 pm   Post subject: (No subject)

this has been rele helpful

im understanding it ... go team

so how could i incorperate this into making a snowfall scene (just suggestions)
guruguru




PostPosted: Wed Mar 10, 2004 8:11 pm   Post subject: (No subject)

Well, arrays arent that hard a concept... Grade 11 seems a little late to be learning htem because its hard to make an efficient, quality program without them. I am in Grade 9 as well, and we have learned arrays and such. Our schools kinda messed up as we do the course for the grade ahead of us. So right now I'm taking TIK20- which is actually the grade 10 course but whatever...

About arrays...
As you probaly know, a variable is simply a place in memory (like a box in a big long chain) that you can put stuff into.
An array is the same but an array consists of a certain number of boxes lined up- all under one name. All the boxes hold the same datatype as well (such as integers). To put something into a certain box, you use a subscrit after the array name
code:

% Create a variable that is one box...
var my_variable : int
my_variable := 8 % Note that no subscripts is used!

% Create an array of 4 boxes in memory that all hold integers
var my_array : 1 .. 4 of int

% To make say... the third box have the value of "5" then...
my_array (3) := 5  % Note the (3) subscript!


Hope that helps...
Quality




PostPosted: Wed Mar 10, 2004 8:15 pm   Post subject: (No subject)

uve been a big help ... ive learnt someting new in about 20 min ... THANK YOU
Cervantes




PostPosted: Wed Mar 10, 2004 8:21 pm   Post subject: (No subject)

edit: hmm... question was answered while I was typing.. interesting Thinking

well Asian made a nice one earlier.

basically what you have to do is create 2 arrays for storing your x and y coords of your snowflakes (you could do a 2d array, but lets stick to simpler stuff for the time being).
use a for loop to initialize random values of x and y to your snowflakes (keep them inside the screen) using Rand.Int. Then go into a loop and then into a for loop where you will make y smaller, draw the ovals (snowflakes), and check to see if y is < 0 (if it is, make y > your screen height). outside that for loop, you should have a cls, a view.update, and a delay to make things look all nice.

hope you can understand that Razz
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  [ 9 Posts ]
Jump to:   


Style:  
Search: