From: mieville@mac.com
Subject: Re: range in ascii
Date: 31 Mar 2005 01:37:08 -0800
Date: 2005-03-31T01:37:08-08:00 [thread overview]
Message-ID: <1112261828.853505.238490@f14g2000cwb.googlegroups.com> (raw)
In-Reply-To: <d1peft$nib$1@news.BelWue.DE>
Hi all, I now have my code to count frequency of letters in a text but
I do not know how to read the command "enter" after I write my text.
What I have now is CTRL+Q but of course is not an elegant solution and
I know there is something easy but I cannot find it. Here below is my
code if someone could help me in that single question I would be
grateful. many thanks - sibyl
with Text_Io;
use Text_Io;
with Ada.Integer_Text_Io;
use Ada.Integer_Text_Io;
procedure Comptelettretest is
Char , char2 : Character;
cod: integer ;
subtype Lettre is Integer range 20..255;
type Freq_Lettre is array (Lettre) of Integer;
Count : Freq_Lettre:= (others => 0);
begin
Put_Line ("Entrer un text au choix et le terminer par 'CTRL/Q' et
'enter' ");
loop
Get(Char);
--how to escape from this instruction, I want to hit enter and
have the list.
exit when Char = ASCII.DC1;
cod := CHARACTER'POS(CHAR);
if cod in Lettre then
Count(cod) := Count (cod) +1;
end if;
end loop;
New_Line;
Put_Line("Frequence des lettres");
New_Line;
for cod in Lettre loop
char2 := CHARACTER'VAL(cod);
Put(char2);
put(Count(cod));
New_Line;
end loop;
end Comptelettretest;
next prev parent reply other threads:[~2005-03-31 9:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-22 15:26 range in ascii mieville
2005-03-22 15:43 ` Peter Hermann
2005-03-31 9:37 ` mieville [this message]
2005-03-31 10:52 ` Anders Wirzenius
2005-03-31 11:23 ` Alex R. Mosteo
2005-03-31 19:15 ` Jeffrey Carter
2005-03-22 17:32 ` Martin Dowie
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox