Computer Science Canada

Need help creating Frequency analysis.

Author:  JR [ Tue Mar 23, 2004 9:05 am ]
Post subject:  Need help creating Frequency analysis.

hey, the program i need to make is a program that reads some text and then makes out a table with the % of letters in all the words.
For example

There you go
then its gonna count the nunber of a..z and output the % of the letter in the words.

i know i should have a program to start but i cant start it.

Author:  nate [ Tue Mar 23, 2004 12:13 pm ]
Post subject: 

code:

var line : string
var letters : array 1 .. 26 of int

for z : 1 .. 26
    letters (z) := 0
end for

put "Enter a line to be Examined"
get line : *

for i : 1 .. length (line)
    if line (i) not= ' ' then
        letters ((ord ((line (i))) - 96)) := letters ((ord ((line (i))) - 96)) + 1
    end if
end for

for i2 : 1 .. 26
    put chr (96 + i2), " | ", letters (i2)
    delay(10)
end for

%You can work on the chart all u want i don't really care


The chart sucks but thats what you can work on.


: