Letter frequency: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: corrected bad English phrasing in the OUTPUT section. -- ~~~~) |
(Changed to columnar order) |
||
Line 1,750: | Line 1,750: | ||
<lang XPL0>include c:\cxpl\codes; \intrinsic 'code' declarations |
<lang XPL0>include c:\cxpl\codes; \intrinsic 'code' declarations |
||
int A(256), C; |
int A(256), C, I; |
||
[for C:= 0 to 256-1 do A(C):= 0; |
[for C:= 0 to 256-1 do A(C):= 0; |
||
repeat C:= ChIn(1); \device 1 doesn't buffer nor echo |
repeat C:= ChIn(1); \device 1 doesn't buffer nor echo chars |
||
A(C):= A(C)+1; \count character |
A(C):= A(C)+1; \count character |
||
until C=\EOF\$1A; |
until C=\EOF\$1A; |
||
C:= 0; |
|||
for |
for I:= 0 to 128-1 do \only show 7-bit ASCII |
||
[ChOut(0, \tab\9); |
[ChOut(0, \tab\9); |
||
case C of |
case C of |
||
Line 1,763: | Line 1,764: | ||
ChOut(0, ^ ); |
ChOut(0, ^ ); |
||
IntOut(0, A(C)); \show count |
IntOut(0, A(C)); \show count |
||
C:= C+16; \columnar order |
|||
if (I&7) = 7 then [CrLf(0); C:= C-8*16+1]; |
|||
]; |
]; |
||
]</lang> |
]</lang> |
||
Example output of |
Example output of count.xpl counting itself: |
||
[[File: |
[[File:Count2XPL0.gif]] |