comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Problem from a Newbie
Date: Thu, 15 Jan 2004 01:03:20 GMT
Date: 2004-01-15T01:03:20+00:00	[thread overview]
Message-ID: <sFlNb.9034$1e.3023@newsread2.news.pas.earthlink.net> (raw)
In-Reply-To: <YafNb.8706$1e.3291@newsread2.news.pas.earthlink.net>

Jeffrey Carter wrote:

> Dennis Lee Bieber wrote:
> 
>>         Cycle : float := 360.0;         --use degrees directly in sin()
>>         HalfWidth : float := 30.0;      --scale 0..1 to 0..30 (and -1..0)
>>         StepCycle : float := Cycle / 45.0;      --reduce total points
>>         Length : integer := integer((2.0 * Cycle) / StepCycle); --#points
> 
> These all appear to be constants, and should be declared as such. The 
> first 3 could be named numbers.
> 
>>         Point : float;
>>         Position : float;
>>
>> begin
>>         for i in 0..Length loop
>>                 Point := ff.sin(float(i) * StepCycle, Cycle);
>>                 Position := Point * HalfWidth + HalfWidth + 1.0;
>>                 new_line;
>>                 for j in 0..integer(Position) loop
>>                         put(" ");       --space output across line
>>                 end loop;
>>                 put("*");
>>         end loop;
>> end wave;

I apologize for leaving this big chunk of quoted text at the end for now 
reason. It's something I try to avoid.

-- 
Jeff Carter
"We use a large, vibrating egg."
Annie Hall
44




      reply	other threads:[~2004-01-15  1:03 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
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 [this message]
replies disabled

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