K
K
kate2018-08-16 01:53:48
C++ / C#
kate, 2018-08-16 01:53:48

How to replace all vowels with spaces?

There is a character string and you need to replace each vowel with a space, I can’t understand what condition for the loop is needed.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2018-08-16
@saboteur_kiev

It seems that in C there are no special conditions for this.
Or a multiple case or make an array of vowels and drive away with another inner loop.

D
dollar, 2018-08-16
@dollar

You need to make an array of boolean variables, and assign an index (character code) to each vowel, and set the values ​​​​to true for these indices. This array is created once and used repeatedly.
Further, in the character string in a loop, check each character. We take its code, turn it into an index - and look in the array, if true, then replace it with a space.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question