You'd have to make a list of the articles, the size of each word, and identify the tokens. To avoid complications from punctuation marks, you can change them to spaces before . Here's one answer using strtok, and isalpha functions. If I can I will make another version that is not dependent of these functions. This program compiles under Borland C++ and runs perfectly with the given example text.
#include
#include
#include
#include
int main(int argc, char *argv[])
{
char *article[]={"the","a","an"};
int len[]={3,1,2};
int count[]={0,0,0};
char li[250];
char *ptr;
char nArt=0;
printf("Enter text:");
gets(li);
printf("%s\n",li);
// first convert the non-alpha characters to spaces
ptr=li;
while(*ptr!=0)
{
if(!isalpha(*ptr))*ptr=' ';
ptr++;
}
// TO BE CONTINUED .....
2007-08-27 09:56:17 補充:
// extract tokens (words) ptr=strtok(li," "); while(ptr!=NULL) { for(int i=0; i<3;i ) { int l1=strlen(ptr); // to be continued
2007-08-27 09:59:55 補充:
It seems to have problems with the length of text.If you send me a PM with your address, I will send you the program as an attachment.
2007-08-27 10:52:45 補充:
You can download the program using two different methods at:
http://files-upload.com/files/461668/FREQ_ART.CPP