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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3cb31983495c2fde X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.125.233 with SMTP id mt9mr6282469pbb.5.1334943237715; Fri, 20 Apr 2012 10:33:57 -0700 (PDT) Path: r9ni78772pbh.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Will Newsgroups: comp.lang.ada Subject: Re: Ada95 Help 2D arrays Date: Fri, 20 Apr 2012 10:33:57 -0700 (PDT) Organization: http://groups.google.com Message-ID: <5774709.1285.1334943237337.JavaMail.geo-discussion-forums@vbbfk16> References: <31137140.191.1334922395977.JavaMail.geo-discussion-forums@ynjb15> NNTP-Posting-Host: 134.240.94.59 Mime-Version: 1.0 X-Trace: posting.google.com 1334943237 14910 127.0.0.1 (20 Apr 2012 17:33:57 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 20 Apr 2012 17:33:57 +0000 (UTC) In-Reply-To: <31137140.191.1334922395977.JavaMail.geo-discussion-forums@ynjb15> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=134.240.94.59; posting-account=CZZpzgoAAAAoaHoNNp9zhY9EzQgEmxhU User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-04-20T10:33:57-07:00 List-Id: Here is my solution and no doubt it does work! type Int_Array is array(Positive range <>) of Integer; type Int_Matrix is array(Positive range <>, Positive range <>) of Integer; function Best_Combined_Score(Grid : Int_Matrix) return Integer is Total : integer := 0; RowTotal : integer := 0; ColumnTotal : integer :=0; Sum : Integer := 0; begin for R in Grid'Range(1)loop RowTotal := 0; for C in Grid'Range(2) loop Rowtotal := Rowtotal +Grid(R,C); end loop; for Column in Grid'Range(2) loop ColumnTotal := 0; for Row in Grid'Range(1)loop ColumnTotal := ColumnTotal + Grid(Row,Column); end loop; Total := RowTotal + ColumnTotal - Grid(R, Column); if Total > Sum then Sum := Total; end if; end loop; end loop; return Sum; end Best_Combined_Score;