comp.lang.ada
 help / color / mirror / Atom feed
* invalid parameter list
@ 2006-02-17 23:13 isaac2004
  2006-02-18  6:02 ` jimmaureenrogers
       [not found] ` <tfadv19pqf17h3prdhquk3e5f30j6vhdhl@4ax.com>
  0 siblings, 2 replies; 20+ messages in thread
From: isaac2004 @ 2006-02-17 23:13 UTC (permalink / raw)


hello
i am getting an error about an invalid parameter in this code

with Ada.Text_Io;
use Ada.Text_Io;
with Ada.Integer_Text_Io;
use Ada.Integer_Text_Io;
procedure Assignment3 is

---------------------------------------------------------------------
   --| program that takes a range in the form of a minimum and maximum
number,
   --| and prompts for the length, to find all sociable chains inside
of the range
   --| to that desired chain
   --| Isaac Levin, Western Washington
   --| February 2006

---------------------------------------------------------------------------

   Start : Natural;
   Stop  : Natural;
   Max   : Natural range 1 .. 30;




   -- start of function that takes the inputted number and finds the
sum of the divisors
   -- function description
   function Sum_Of_Divisors (
         N : Integer)
     return Integer;

   -- function body

   function Sum_Of_Divisors (
         N : Integer)
     return Integer is
      C   : Integer;
      Sum : Integer;

   begin
      Sum := 1;
      C:=2;
      while C**2 <= N loop --Number

         if N mod C = 0 then
            if C * 2 = N then
               Sum := Sum + C;
            else
               Sum := Sum + C + N / C;
            end if;
         end if;
         C := C + 1 ;
      end loop;
      return Sum ;

   end Sum_Of_Divisors;




   procedure Sociable_Chain (
         Start,
         Max   : Natural) is
      A : array (1 .. 30) of Positive;
      I : Positive;

   begin
      A(1) :=Start; -- makes first number of array the prompt number
      A(2) := Sum_Of_Divisors (A(1)); -- 2nd number in array is sum of
divisors of prompt
      while I < Max and A (1) /= A(I) loop -- loop till length is
reached and till A(I) = A(1)
         I:= I + 1;
         A(I) := Sum_Of_Divisors (A(I - 1));


      end loop;

   end Sociable_Chain;

begin


   Put(Item => " Please enter your starting integer. ");
   Get(Item => Start);
   New_Line;
   Put(Item => " Please enter your ending integer. ");
   Get(Item => Stop);
   New_Line;
   Put(Item => " Please choose the length of your chain. ");
   Get(Item => Max);



   --         for N in Minnumber..Maxnumber loop
   --            Sociable_Chain(Minnumber, Length);

   --         end loop;

-- Put (Item => Sum_Of_Divisors (Start), Width => 0  ) ;

---------------------------------------------------error here
   Put (Item => Sociable_Chain ( Start, Max ), Width => 0  ) ;

-----------------------------------------------------------------------------------------


end Assignment3 ;

am i specifying the wrong values for my procedure

thanx for the help




^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2006-02-22  8:27 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-17 23:13 invalid parameter list isaac2004
2006-02-18  6:02 ` jimmaureenrogers
     [not found] ` <tfadv19pqf17h3prdhquk3e5f30j6vhdhl@4ax.com>
2006-02-18  8:04   ` isaac2004
2006-02-18 14:34     ` Björn Persson
2006-02-18 21:19       ` isaac2004
2006-02-18 23:31         ` Björn Persson
2006-02-18 23:34           ` Martin Dowie
2006-02-19  0:06             ` isaac2004
     [not found]               ` <dmlfv11b4qagaf3gec853k9on191576gqc@4ax.com>
2006-02-19  4:06                 ` isaac2004
     [not found]                   ` <uavfv1pjdorpim6lpu8sjfdlq4lmmn1jes@4ax.com>
2006-02-19 16:21                     ` Björn Persson
2006-02-19 15:54               ` Björn Persson
2006-02-19  0:15             ` Ada.Text_IO.Create (was: invalid parameter list) Björn Persson
2006-02-19  8:14               ` Ada.Text_IO.Create Martin Dowie
2006-02-19 19:45                 ` Ada.Text_IO.Create Jeffrey R. Carter
2006-02-19 21:49                   ` Ada.Text_IO.Create Larry Kilgallen
2006-02-20  6:09                     ` Ada.Text_IO.Create isaac2004
2006-02-20  6:43                       ` Ada.Text_IO.Create Gautier
     [not found]                       ` <3stiv1l39144oscbs5he2v6h5uvfmli03q@4ax.com>
2006-02-21 22:15                         ` Ada.Text_IO.Create isaac2004
2006-02-22  7:45                           ` Range error (was: Ada.Text_IO.Create) Björn Persson
2006-02-22  8:27                             ` Range error Björn Persson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox