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,e3ba37c5a979fdcb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,CP1252 Path: g2news1.google.com!news1.google.com!news3.google.com!news.glorb.com!newspeer1.se.telia.net!se.telia.net!masternews.telia.net.!newsb.telia.net.POSTED!not-for-mail From: =?windows-1252?Q?Bj=F6rn_Persson?= User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: invalid parameter list References: <1140218028.145204.141420@z14g2000cwz.googlegroups.com> <1140249851.389233.273980@g47g2000cwa.googlegroups.com> <1140297548.116832.212770@g43g2000cwa.googlegroups.com> <57OJf.45346$d5.201767@newsb.telia.net> <1140307577.816883.185870@g43g2000cwa.googlegroups.com> In-Reply-To: <1140307577.816883.185870@g43g2000cwa.googlegroups.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Date: Sun, 19 Feb 2006 15:54:53 GMT NNTP-Posting-Host: 83.250.106.90 X-Complaints-To: abuse@telia.com X-Trace: newsb.telia.net 1140364493 83.250.106.90 (Sun, 19 Feb 2006 16:54:53 CET) NNTP-Posting-Date: Sun, 19 Feb 2006 16:54:53 CET Organization: Telia Internet Xref: g2news1.google.com comp.lang.ada:2993 Date: 2006-02-19T15:54:53+00:00 List-Id: isaac2004 wrote: > i still dont understand how to test the sociable chain part and then > finally write to a file, do i just go something like > > chains : File_Type; > > > code > > Create(File => chains, Mode => Out_File, Name => "chains.txt") Correct this far. > Put (File => chains, Item => Sociable_Chain ( Start, Max), Width => 0); I assume you have some resource where you can look up the definition of Ada.Integer_Text_IO.Put. (If not, tell your teacher you need a reference to the standard library, so that you can know how to use it.) You'll see that the type of Item is Integer. The compiler would accept the statement above if you'd turn Sociable_Chain into a function and made it return Integer (or a subtype of Integer such as Natural) � but what number should it return? You need to print the whole chain, not just one integer. You'll have to go through the array and call Put once for each number in the chain, and once more to print the length. So how do you go through an array and do something with each element? With a loop of course: for Index in An_Array'Range loop Put(File => chains, Item => An_Array(Index), Width => 0); end loop; -- Bj�rn Persson PGP key A88682FD omb jor ers @sv ge. r o.b n.p son eri nu