Answer the question
In order to leave comments, you need to log in
How to count the number of consonants surrounded by numbers in C language?
Task: "Count the number of consonant letters of the string s, which are surrounded by numbers on both sides."
I thought somehow using a cycle to assign some value to each character, and then using another cycle to work with these values. Roughly speaking, if some a="one of the consonants" and at the same time a-1 and a+1 ="any number", then the variable b, which will be the number of such letters, increases. In words, it may be so, but in reality I do not understand how it should look like.
Answer the question
In order to leave comments, you need to log in
I would make a "character class" enum with the values vowel, consonant, digit, etc.
In the loop, we define the classes of the current, previous and next character. Further, I hope, it is obvious. :)
And in deeds as well as in words.
somehow using a loop to assign some value to each character
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question