If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > c++ programe help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-30-08, 03:16
hkp819 hkp819 is offline
Registered User
 
Join Date: Dec 2008
Posts: 59
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.
__________________
New York Web design
Website design

Reply With Quote
  #2 (permalink)  
Old 12-30-08, 05:34
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,002
Total number of lines in what?
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 12-31-08, 03:07
hkp819 hkp819 is offline
Registered User
 
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.
__________________
New York Web design
Website design

Reply With Quote
  #4 (permalink)  
Old 12-31-08, 04:59
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,002
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
Twitter | Blog
Reply With Quote
  #5 (permalink)  
Old 12-31-08, 11:57
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,307
WC.

-PatP
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On