help please. to list words and.....
Hi there.
i got this program to do 4 an assignment...i finished up to a part, but i can't seem to do the final bit....the program is supposed to display the word of each sentence as a list on the screen and stating which sentece the words belong to.eg
sentence 1
word
word
sentence2
word
word .....and so on
if the paragraph has puncutation characters it should not be listed in the list.
i know'i'm asking too much but i was trying all nite last nite and all day today to figure it out........PLEASE HELP
thank you
#include <stdio.h>
#define max_char 100
main(){
char para[max_char];
int len_sent,i,count,unit;
printf("Please enter a paragraph\n");
fflush(stdin);
gets(para);
len_sent = strlen(para);
count=0;
for(i=0;i<len_sent;i++) {
if (para[i]=='.'){
count++;
}
}
printf("the number of sentences are: %d\n", count );
count=1;
for(i=0;i<len_sent;i++){
if (para[i]== ' ') {
count++;
}
}
printf("The number of words in the paragraph are %d\n",count);
}