so i find the period or whatever the sentence ends in. Then I create a substring from that and delete the part which contains the end character. Then i keep count of it.
lotrsimp12345 37 Posting Pro in Training
Recommended Answers
Jump to PostNot sure why you want to delete anything, but counting lines by counting periods is one way to do it yes.
Keep in mind that periods are also used for other purposes like abbreviations and stuff like this >...
Jump to Postif(character=(passage.find('.')))
I was just going through your code and found out this,
You are assigning a value to the variable character instead of checking.
it should actually be
if(character[b]==[b](passage.find('.')))
Jump to Postcharacter is of type integer. and it is not an array .
I wish to know what you are trying to achieve in the following code
That way it would be easier to help..if(character[i]==(passage.find('.'))) { passage.erase(0,character+1); sentence++; }
Jump to PostYou should be using this function:
http://www.cplusplus.com/reference/string/string/find_first_of/
string delimeters = ".?!"; string passage = "ab.cd.ef!gh?ij."; int pos = passage.find_first_of (delimiters);
It'll find the first incidence of '.', '?', or …
All 13 Replies
Nick Evan 4,005 Industrious Poster Team Colleague Featured Poster
lotrsimp12345 37 Posting Pro in Training
lotrsimp12345 37 Posting Pro in Training
Sky Diploma 571 Practically a Posting Shark
lotrsimp12345 37 Posting Pro in Training
Sky Diploma 571 Practically a Posting Shark
lotrsimp12345 37 Posting Pro in Training
lotrsimp12345 37 Posting Pro in Training
Sky Diploma 571 Practically a Posting Shark
lotrsimp12345 37 Posting Pro in Training
VernonDozier 2,218 Posting Expert Featured Poster
lotrsimp12345 37 Posting Pro in Training
lotrsimp12345 37 Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.