From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e52f7c34095c85e5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: "zork" Newsgroups: comp.lang.ada References: <40fea9b7@dnews.tpgi.com.au> Subject: Re: unconstrained array type problems Date: Thu, 22 Jul 2004 09:11:23 +1000 Organization: - X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 NNTP-Posting-Host: 220.245.100.34 X-Original-NNTP-Posting-Host: 220.245.100.34 Message-ID: <40fef833@dnews.tpgi.com.au> X-Trace: dnews.tpgi.com.au!tpg.com.au 1090451507 220.245.100.34 (22 Jul 2004 09:11:47 +1000) Path: g2news1.google.com!news1.google.com!news.glorb.com!solnet.ch!solnet.ch!nntp.gblx.net!nntp3.phx1!dnews.tpgi.com.au!tpg.com.au!not-for-mail Xref: g2news1.google.com comp.lang.ada:2336 Date: 2004-07-22T09:11:23+10:00 List-Id: Thanks for the help everyone! The transition from c++ to ADA doesnt seem that smooth. But im getting there. thanks! zork 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;