How to count sentences in a paragraph..." using c language
Solved/Closed
                    
        
                    gealon2024
    
        
                    Posts
            
                
            7
                
                            Registration date
            Thursday October  3, 2013
                            Status
            Member
                            Last seen
            April 30, 2014
            
                -
                            Oct  3, 2013 at 10:11 PM
                        
indhu - Jan 10, 2016 at 08:47 AM
        indhu - Jan 10, 2016 at 08:47 AM
        Related:         
- How many sentences there are on the paragraph
- Count names in excel - Guide
- Count occurrences in excel - Guide
- Instagram following count not updating - Instagram Forum
- Count if cell contains number - Excel Forum
- How to hide subscriber count - Guide
3 responses
                        
                            
                    Hello,
Grammatically speaking, a sentence is terminated by a dot. If you want to count the number of sentences, you just have to count the number of dots
Here is a piece of code. Not tested but the idea is here
Note: I've renamed your variables to make sense
@+
Buno, Modo CS-CCM
The urgent is done, the impossible is underway. For miracles, envisage a time ...
            Grammatically speaking, a sentence is terminated by a dot. If you want to count the number of sentences, you just have to count the number of dots
Here is a piece of code. Not tested but the idea is here
int main()
{
char paragraph[1000];
int nbChar, nbSentences;
// display prompt and get paragraph
clrscr();
printf("Enter your a paragraph\n\n\t: ");
gets(paragraph);
// get number of characters
nbChar = strlen(paragraph);
// read paragraph and count dot character
nbSentences = 0;
for (int i=0; i<nbChar; i++)
{
if (paragraph[i]=='.')
{
nbSentences++;
}
}
// display result
printf("\n\nTotal sentences: %d", nbSentences);
getch();
return 0;
}
Note: I've renamed your variables to make sense
@+
Buno, Modo CS-CCM
The urgent is done, the impossible is underway. For miracles, envisage a time ...
