/ Published in: C
Q.WAP to find the smallest and largest word that a user entered in C language. The program needs to terminate when the user enters a four lettered word. (Question from K N King C modern approach)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include<stdio.h> #include<string.h> int count = 0; // To count the number of words char smallest_word[20]; //To store the smallest word char largest_word[20]; // To store the largest word void print_words(char phrase[10][20]);// to print all the words void get_words(char phrase[10][20]);//to get the words from the user void compare_words(char phrase[10][20]);//function to find the smallest and the largest word in the group. int main() { char phrase[10][20]; get_words(phrase); compare_words(phrase); print_words(phrase); return 0 ; } void print_words(char phrase[10][20]) { for(int i = 0 ;i<count;i++) { } } void get_words(char phrase[10][20]) { int length_str = 0; for(int i = 0 ;length_str!=4;i++) { ++count; } } void compare_words(char phrase[10][20]) { for(int i = 1;i<count;i++) { { } { } } }