Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2008
    Posts
    59

    Unanswered: c++ programe help

    Can any body help to write a program to count total no. of lines in it and total no of word, space, character.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Total number of lines in what?
    George
    Home | Blog

  3. #3
    Join Date
    Dec 2008
    Posts
    59
    I think you never understand my problem. My problem is to count the total no of word, space, line, number in the string of character.
    for eg.
    consider a string
    My name is harish. I am going to school.
    In this above string.
    total no. of line is 2,
    total no of word is 9,
    total space is 8,
    total character is 39.

    please help me to solve my problem.

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Here's some general approximations that should get you started

    Number of lines = Len(string) - Len(Replace(string, ".", ""))
    Number of words = Len(string) - Len(Replace(string, " ", "")) + 1
    etc
    George
    Home | Blog

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    WC.

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •