An array of an array
Author |
Message |
mwachna
|
Posted: Tue Mar 01, 2005 1:27 pm Post subject: An array of an array |
|
|
Ok...i have 3 parametres...first is the subject, topic, and days needed to cover the topic.
each are represened by int's.
subject=3
topic(subject(1))=3; topic(subject(2))=2; topic(suject(3))=1
days(t(s(1))(1))=2 %this means that the days needed to cover the 1st topic of the first subject is 2; days(t(s(1))(2))=1; days(t(s(1))(3))=1
days(t(s(2))(1))=4; days(t(s(2))(2))=2
days(t(s(3))(1))=8
so ideally i would like to call upon a variable, lets call it "AtClass" in the form of "AtClass(S,T,D)" %haha...STD not intentional
i would like this variable to contain the number of students in class.
so if AtClass(2,1,3)=10, that would mean that 10 children were presend for the 3rd day of the first topic covered in subject 1.
basically i want to do:
var AtClass: array of 1..3, 1..(topics for subject of the first parametre), 1..(days for the topic # of the second parameter for the subject of the first parameter) of int
sorry this is really hard to describe |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Tue Mar 01, 2005 1:29 pm Post subject: (No subject) |
|
|
yes |
|
|
|
|
|
jamonathin
|
Posted: Tue Mar 01, 2005 2:21 pm Post subject: (No subject) |
|
|
lol, yeah, whatever your code is, use the code tools, so then it wont look like a bunch of letters bunched together, and we can deciefer between everthing. |
|
|
|
|
|
person
|
Posted: Tue Mar 01, 2005 3:48 pm Post subject: (No subject) |
|
|
i really dont get ur problem...but maybe im the only one lost? |
|
|
|
|
|
Flikerator
|
Posted: Tue Mar 01, 2005 4:11 pm Post subject: (No subject) |
|
|
Use a record with an array. If I understand the problem clearly use them. There are two tutorials in the tutorials section on both.
code: | type Students :
record
subject
days
topic
end record |
Looks something like that, manipulate it as you please. |
|
|
|
|
|
mwachna
|
Posted: Tue Mar 01, 2005 7:48 pm Post subject: in code... |
|
|
here, this is what i have for a temporary code: (to animate a dance step)
code: |
var Steps : array 1 .. 3, 1 .. 100 of int
var StepName : array 1 .. 3, 1 .. 100 of string
var TotSteps : array 1 .. 3 of int
var preview : array 1 .. 10 of array 1 .. 3, 1 .. 100 of int
%note: i used "100" as an extreme limit, however, the limits vary and are
%all under 20
proc Preview (region : int, step : int) %3 possible region value
%each region has a unique amount
%of steps ("step")
loop
for rep : 1 .. Frames (region, step) %how many frames for this step
Pic.Draw (preview (rep) (region, step), 100, 0, picCopy)
delay (500)
end for
exit when hasch
end loop
end Preview |
|
|
|
|
|
|
Flikerator
|
Posted: Tue Mar 01, 2005 7:51 pm Post subject: (No subject) |
|
|
When submitting code make sure to put on "Code" Format... and include the vars >.< |
|
|
|
|
|
Bacchus
|
Posted: Tue Mar 01, 2005 9:15 pm Post subject: (No subject) |
|
|
so if im understanding this right... you want an array with a sub-array that has a sub-array?
[code]var blah:array 1..x,1..x,1..x of watever[code]
or if you wanted one array but with different subheadings:
[code]var blah:array 1..x of
record
a:int
b:string
end record[/code] |
|
|
|
|
|
Sponsor Sponsor
|
|
|
mwachna
|
Posted: Wed Mar 02, 2005 1:16 am Post subject: arrays |
|
|
Well i more want to have an array of an array, but i want to set the parametres seperately for each part of the array. If i wanted to do it the long and complex way, we would be looking at something like this:
code: |
var TotalClass1Topic1Day1:int
var TotalClass1Topic1Day2:int
var TotalClass1Topic1Day3:int
var TotalClass1Topic2Day1:int
var TotalClass1Topic2Day2:int
var TotalClass2Topic1Day1:int
var TotalClass2Topic1Day2:int
var TotalClass2Topic1Day3:int
var TotalClass2Topic2Day1:int
var TotalClass2Topic2Day2:int
var TotalClass2Topic2Day3:int
var TotalClass2Topic3Day1:int
var TotalClass2Topic3Day2:int
var TotalClass3Topic1Day1:int
var TotalClass3Topic1Day2:int
var TotalClass3Topic2Day1:int
var TotalClass3Topic2Day2:int
|
as you can see...its way to much variable declaration and if i wanted to output one of these variables depending on an independent condition i would have to create the world's largest if statement.
There has to be away for me to group these together into some kind of array so that i can just say "put Toltal(x)(y)(z)" or "put Total(x,y,z)" where x y an z are variables with values generated from an independent event.
if this doesn't clear things up, don't worry about it. I will hammer things out edvintually. |
|
|
|
|
|
Tony
|
Posted: Wed Mar 02, 2005 9:59 am Post subject: (No subject) |
|
|
just wondering... has a thought of trying out the code ever occured to you? What you're trying to do is compleatly legal.
Turing: |
var foo : array 1 .. 3, 1 .. 3, 1 .. 3 of int
for x : 1 .. 3
for y : 1 .. 3
for z : 1 .. 3
foo (x, y, z) := x + y + z
end for
end for
end for
|
|
|
|
|
|
|
Ayoun
|
Posted: Sun Mar 06, 2005 12:29 pm Post subject: ur so dumn |
|
|
damn you stupid people!!! |
|
|
|
|
|
Flikerator
|
Posted: Sun Mar 06, 2005 3:20 pm Post subject: Re: ur so dumn |
|
|
Ayoun wrote: damn you stupid people!!!
err? What is that supposed to mean. "Oh no someone doesnt know something".. |
|
|
|
|
|
mwachna
|
Posted: Mon Mar 07, 2005 11:21 am Post subject: (No subject) |
|
|
I have found a solution to the problem...for better understanding, and an answer to my problem, check out the tutorial: "arrays of arrays and more arrays." |
|
|
|
|
|
|
|