-Read the sentence from somewhere (user input, text file, etc.).
-Split the sentence into words.
-Count consonants for each word and output the one with the most consonants.
@Answerx: Yup that is C++, I think you are asking for C. You should follow webjose's instructions but here are some more tip for finding the consonants in a given word:-
Use consonant (char array) = ""zrtpqsdfghjklmwxcvbn"
Assuming you have a variable "word" which contain the word which you want to check
Iterate through the word taking one char at a time. Use strstr to check whether it is a consonant or not and record it.
Then return the value from the function. Easy enough!!
Ok I will explain what i am doing:
First, the parameter std::istream& let you perform the function on any stream: a string, a file, stdin... . For example if you want to call the function on a string, you just have to domaxConsonants(std::istringstream("test test2"), on input you domaxConsonants(std::cin)... .
In the while test(l.14), I retrieve the characters from the stream an test if it is the end(-1).
And in the while body, three cases:
1) the char is a space (l.18): I test if the last string builded have the most consonants and if yes if put it as the max string
2)the char is a consonant(l.27): i increment the max count