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,1f78990666319a12 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.swip.net!swipnet!newsfeed1.funet.fi!newsfeeds.funet.fi!nntp.inet.fi!central1.inet.fi!inet.fi!read3.inet.fi.POSTED!53ab2750!not-for-mail Sender: AWI003@FIW9430 Newsgroups: comp.lang.ada Subject: Re: range in ascii References: <1111505197.604268.101910@l41g2000cwc.googlegroups.com> <1112261828.853505.238490@f14g2000cwb.googlegroups.com> From: Anders Wirzenius Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 31 Mar 2005 10:52:46 GMT NNTP-Posting-Host: 194.251.142.2 X-Complaints-To: abuse@inet.fi X-Trace: read3.inet.fi 1112266366 194.251.142.2 (Thu, 31 Mar 2005 13:52:46 EEST) NNTP-Posting-Date: Thu, 31 Mar 2005 13:52:46 EEST Organization: Sonera corp Internet services Xref: g2news1.google.com comp.lang.ada:10179 Date: 2005-03-31T10:52:46+00:00 List-Id: mieville@mac.com writes: > 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_Immediate (Char); Put (Char); -- Get (Char) > Get(Char); > > --how to escape from this instruction, I want to hit enter and > have the list. exit when Char = ASCII.CR; -- Works at least on Windows > 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; Anders