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

Discussion in 'C' started by fhmm, Oct 2, 2006.

  1. fhmm

    fhmm New Member

    Joined:
    Oct 2, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,336
    Likes Received:
    377
    Trophy Points:
    83
    Refer [thread=1518]Counts each alpahbets occurs how many times[/thread]. 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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice