comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: Problem from a Newbie
Date: Tue, 13 Jan 2004 06:37:27 -0600
Date: 2004-01-13T06:37:27-06:00	[thread overview]
Message-ID: <PCRMb.6589$eq.1354@bignews6.bellsouth.net> (raw)
In-Reply-To: 4003b00c_2@news.tm.net.my

The Sin function is contained in the package
Ada.Numerics.Generic_Elementary_Functions
which must be "withed," and then instantiated
for type "Float."

The result of the function is a value of type
"Float," so it cannot be assigned to the
Integer variable "Y," as you have done in
your code.

Also, the loop variable "R" in your code must
be a discrete type, not a real type.

"Cecilia Chew" <cecilia@nowhere.com> wrote in message
news:4003b00c_2@news.tm.net.my...
> Hello All,
> I'm a newbie in Ada. There are a lot of question mark in my mind. I'm
> now doing a simple program and the desired output is a signal wave as
below.
>
> *      **      **      *
>   *    *  *    *  *    *
>    *  *    *  *    *  *
>     **      **      **
> And the coding that i have done is as follow.
>
> with Ada.Text_Io, Ada.Float_Text_IO;
> use Ada.Text_Io, Ada.Float_Text_IO;
>
> procedure Graph1 is
>     Y : Integer;
>     Max_Point : Float;
>     Min_Point : Float;
>     Pi : Constant := 3.142;
> begin
>
>     Max_Point := 1.0;
>     for X in 0 .. 360 loop
>        for r in 0.0 .. Max_Point loop
>           Y := sin (X * 2 * Pi/360);
>           Put ("*");
>        end loop;
>     end loop;
> end Graph1;
>
> Could someone tell me what are the mistakes in the coding? Error message
> from the compiler is the 'sin' is undefined. what should i do with this?
>
>
> -- 
> Cecilia Chew
> c e c i l i a <AT> g r e e n l i m e . c o m
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada-france.org
> http://www.ada-france.org/mailman/listinfo/comp.lang.ada
>
>




  reply	other threads:[~2004-01-13 12:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-13  8:44 Problem from a Newbie Cecilia Chew
2004-01-13 12:37 ` David C. Hoos [this message]
2004-01-13 17:42 ` Jeffrey Carter
2004-01-14  5:49 ` Steve
2004-01-14 21:08   ` Simon Wright
     [not found] ` <kc8fd1-ul5.ln1@beastie.ix.netcom.com>
2004-01-14 16:42   ` Jean-Pierre Rosen
2004-01-15  8:56     ` Dmitry A. Kazakov
2004-01-14 17:41   ` Jeffrey Carter
2004-01-15  1:03     ` Jeffrey Carter
replies disabled

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