Question: You might recognize the code on the next page as being the wds.c program from the text and spell checker fame. Modify this program to

You might recognize the code on the next page as being the wds.c program from the text and spell checker fame. Modify this program to print each word on a separate line with the phrase has double letters after any word that has the same letter twice adjacent to each other in the word.

For example, the input: Ever really looked at the moon, Lloyd?

would output:

Ever

really has double letters

looked has double letters

at

the

moon has double letters

Lloyd has double letters

You might recognize the code on the next page as being the

#include #include #include "tfdef.h" "chrut 11.h" main ( signed char ch; int inword lns, wds, chrs; /* flag indicating when in a word /*Counters for lines, words, chars. lns - wds-chrs - 0; /* initialize counters to 0 inword FALSE; /* before beginning we are not in a word / while ((ch - getchar )) !- EOF) /* while there are more chars */ chrs-chrs + 1; if (ch 'n) /*count characters /if newline char /*count lines lns-lns 1; /if not in a word and not a delimiter/ /*then this must be the beginning of a word */ if (!inword && Idelimitp(ch))/* if not in word and not delim*/ inword = TRUE wds-wds 1; /remember we are in a word /count words /otherwise if in a word, but found a delimiter */ /* then we just went beyond the end of the word*/ else if (inword && delimitp(ch))/* if in word and a delim*/ 1inword - FALSE; /* no longer in word /end word with newline * putchar (n'); if (inword) /*if in a word putchar (ch); /* print the character /

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!