From: "zork" <zork@nospam.com>
Subject: Re: unconstrained array type problems
Date: Thu, 22 Jul 2004 09:11:23 +1000
Date: 2004-07-22T09:11:23+10:00 [thread overview]
Message-ID: <40fef833@dnews.tpgi.com.au> (raw)
In-Reply-To: kDyLc.157648$XM6.36144@attbi_s53
Thanks for the help everyone! The transition from c++ to ADA doesnt seem
that smooth. But im getting there.
thanks!
zork
<tmoran@acm.org> wrote in message news:kDyLc.157648$XM6.36144@attbi_s53...
> >open (file)
> >
> >read in dimensions of array1
> >create the array1
> >fill the array1
> >
> >read in dimensions of array2
> >create the array2
> >fill the array2
> >
> >close (file)
> >
> >allow the arrays to interact with one another
> >---
> >
> >I cannot see a way around this.
>
>
> Repeating and expanding on Marius Amado Alves message:
> > > How can i make them visible to one another? This is so easy to do in
> > > c++/java.
> >
> > This is extremely easy in Ada with the proper design, namely with these
> > two entities:
> >
> > type Matrix is array (Positive range <>, Positive range <>) of Real;
> function Read_Matrix(File : File_Type) return Matrix is
> Row_Count, Column_Count : Positive;
> begin
> Get (File, Row_Count);
> Get (File, Column_Count);
> declare
> Result: Matrix_Type (1 .. Row_Count, 1 .. Column_Count);
> begin
> -- read in matrix data
> return Result;
> end;
> end Read_Matrix;
> >
> > Then read all the matrices you want in the same place:
> >
> procedure Do_Matrices is
> > Matrix_1 : Matrix := Read_Matrix(File);
> > Matrix_2 : Matrix := Read_Matrix(File);
> Product : Matrix(Matrix_1'range(1), Matrix_2'range(2)); -- for
example
> begin
> -- do stuff with Matrix_1 and Matrix_2
> end Do_Matrices;
next prev parent reply other threads:[~2004-07-21 23:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-21 15:04 unconstrained array type problems zork
2004-07-21 15:09 ` Ludovic Brenta
2004-07-21 15:33 ` zork
2004-07-21 15:54 ` Marius Amado Alves
2004-07-21 16:24 ` Ludovic Brenta
2004-07-21 17:33 ` Georg Bauhaus
2004-07-21 17:35 ` zork
2004-07-21 18:30 ` tmoran
2004-07-21 23:11 ` zork [this message]
2004-07-22 7:57 ` Martin Krischik
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox