Hello!
I am first year student and i really need your help with writing very simple assignment! I am sure that this will be easy to solve for you!
I have done something but it is not working! Can you check why?:
Division of text into sentences.
Write filter that divides the input text into sentences.
Remarks:
- Each sentence sends with one of the following characters: '.", '?', or '!'.
- Use a special function isSentEnd to detect characters ending a sentence.
- The isSentEnd function has the following prototype: bool isSentEnd(int c);
- The ending character must be included in the sentence. The new line character '\n' follows immediately.
- Spaces, tabulation and new line characters separating sentences must be omitted.
- The maximum allowed length of a sentence is 200 characters. Sentences exceeding the limit must be cut.
- The sequences of white space characters (new line '\n' and tabulation '\t' and a regular space ' ' ) inside a sentence should be replaced by a single space.
And here is my filter:
#include <vcl.h>
#pragma hdrstop
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <string.h>
#pragma argsused
bool isSentEnd(char wrd[], int size)
{
int c, i;
if (c==EOF) return(false);
wrd[0]=c; i=1;
while ((c=getchar())!=EOF && (c='?') || (c='!') || (c='.'))
{
if (i<size) wrd[i]=c; i++;
}
if (wrd[i]=('!' || '?' || '.'));
return(strlen(wrd));
}
int main(int argc, char* argv[])
{
int c;
char w[200];
while (isSentEnd(w, sizeof(w)))
puts(w);
return 0;
}
We are not sure how to solve this problem!
HELPPP!!! PLEASE