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 Post— Nick Evan 4,005Not 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 Post— Sky Diploma 571if(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 Post— Sky Diploma 571character 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 Post— Sky Diploma 571if(character[i]==(passage.find('.'))) { passage.erase(0,character+1); sentence++; }Replace this with something like
if(issentence(passage[i])==true) { sentence++; }After that write down a function
bool issentence(char);Which returns true if the character is a '.' or ',' or '!' or '?'
I guess that's …
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.