Array Question 
Author Message
 Array Question

I would like to make two arrays with each three numbers (3.0 and 3.4 and
4.0 in one array and 45.3 and 48.6 and 54.5 in the other array).

Then I would like to make counters of those two arrays (for Array one
... etc) so that I can combine these six parameters to a total of nine
different simulations.

Can anyone please tell me how to make an array of three numbers (I know
how to make an array like [1..100] OF integer but dunno for three
numbers.)

Please help me, it's for an assignment at my University.

Thanxx...

Maarten Strobosch
Student at the Technical University of Delft
The Netherlands



Sat, 27 Nov 1999 03:00:00 GMT  
 Array Question

Quote:

>I would like to make two arrays with each three numbers (3.0 and 3.4 and
>4.0 in one array and 45.3 and 48.6 and 54.5 in the other array).
>Then I would like to make counters of those two arrays (for Array one
>... etc) so that I can combine these six parameters to a total of nine
>different simulations.
>Can anyone please tell me how to make an array of three numbers (I know
>how to make an array like [1..100] OF integer but dunno for three
>numbers.)
>Please help me, it's for an assignment at my University.
>Thanxx...
>Maarten Strobosch
>Student at the Technical University of Delft
>The Netherlands

Maarten, I have difficulty understanding what you wish. Do you wish to
take ONE array index and have THREE numbers delivered at once? You can
only get them sequentially but you can do that with an array of an
array, an array of records or an array of pointers to records.

If you wish each set of three numbers to stay together each time you
call them so they can be combined with another set of three numbers to
make 9 PAIRS (one number from each set) that is done below. To be sure
we are thinking the same way, the set of numbers a, b, c would be used
with x, y, z to make ax, ay, az, bx, by, bz, cx, cy and cz.

This is just a demo.  Only two sets of 9 combinations are shown.

Regards,

================================================        }

Program Simulation;

CONST maxparm = 3;  {expand as you wish}

TYPE
RealArray = Array[1..3] of Real;

VAR
test:Array[1..maxparm] of RealArray;
i, j, k:Integer;

Begin                          
     test[1][1] := 3.0;
     test[1][2] := 3.4;
     test[1][3] := 4.0;

     test[2][1] := 45.3;
     test[2][2] := 48.6;
     test[2][3] := 54.5;

     test[3][1] := 5.5;
     test[3][2] := 6.6;
     test[3][3] := 7.7;

     i := 1;
     While i < maxparm Do
     Begin
          Writeln; Writeln;
          For j := 1 to 3 Do
              For k := 1 to 3 Do
                  Writeln(test[i][j]:8:2,' ', test[i+1][k]:8:2);
          Inc(i);
     End;
Writeln; Write('Press Enter'); Readln;
End.



Sat, 27 Nov 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Simple array question

2. newbie array question

3. Array question

4. Array question

5. array question

6. Dynamic array question ...

7. Pascal Array Question

8. Question: Arrays

9. question about a problem with arrays

10. Pascal Question about alphabetizing an array of strings...Thanks

11. Question about arrays

12. Beginner Question: Convert an array to a string...

 

 
Powered by phpBB® Forum Software