Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   counting the percentage and occurence of each identical word in input file (http://www.go4expert.com/forums/counting-percentage-occurence-identical-t1515/)

 fhmm 2Oct2006 17:22

counting the percentage and occurence of each identical word in input file

I am an intermediate programmer and i tried to solve the following programme but with no success the programme is a simple text analyzer that read an input file and cumpute the occurence and percentage of each similar word .for example lets consider the following input file.

"The for structure totals the elements of the array one row at the time. The outer for structure begins by setting row of the array to 0."

the analysis of the programme shold be the following:

Word///////////////// Frequency ////////////// %
the///////////// 6 ///////////// 22.25%
for//////////// 2 //////////// 7.41%
structure///////// 2 /////////// 7.41%
totals /////////// 1 ////////// 3.70%
elements /////// 1 ///////// 3.70%
of ////// 2 //////// 7.41%
Array//////// 2 ////// 7.41%
one//////// 1 //////// 3.70%
row/////////// 2 //////// 7.41%
at/////////// 1 ////// 3.70%
time/////////// 1 ///// 3.70%
outer ////////// 1 //// 3.70%
begins /////// 1 /// 3.70%
by ////// 1 // 3.70%
setting ///// 1 ///// 3.70%
to ///// 1 ///// 3.70 %
0 //// 1 //// 3.70%

Total words////////////////////////// 27

 shabbir 2Oct2006 22:25

Re: counting the percentage and occurence of each identical word in input file

Refer Counts each alpahbets occurs how many times. The article counts the characters but the words would not be any different. Also the percentage can easily be derived if you have the figures.

 All times are GMT +5.5. The time now is 21:00.