Writing a Program that Finds the "Smallest" and "Largest" Words

Write a program that finds the "Smallest" and "Largest" in a series of words. After the user enter the words, the program will determine which words would come first and last if the words were listed in dictionary order. The program must stop accepting input when the user enters a four-letter word.assume that no word is more than 20 letters long. An interactive session with the program might look like.

Enter word: dog
Enter word: zebra
Enter word: rabbit
Enter word: catfish
Enter word: walrus
Enter word: cat
Enter word: fish

Smallest word: cat
Largest word: zebra

This is from the C programming/a modern approach by K.N.King.

Must be in code-blocks (C not C++).

© SolutionLibrary Inc. solutionlibary.com 9836dcf9d7 https://solutionlibrary.com/computer-science/software-development/writing-a-program-that-finds-the-smallest-and-largest-words-7gvr

Solution Preview

char largest[30];

printf("Enter word: ");
scanf("%s", inputStr);
strcpy(smallest, inputStr);
strcpy(largest, inputStr);

while ...