-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblemnumber22.cpp
More file actions
41 lines (34 loc) · 859 Bytes
/
Copy pathproblemnumber22.cpp
File metadata and controls
41 lines (34 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include <string>
using namespace std;
//function that takes a string argument and returns that same string with all vowels removed
string remove_vowels(string str) {
string srd = "";
for (int i = 0; i < str.size(); i++)
{
if (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u')
{
continue;
}
else
{
srd += str[i];
}
}
return srd;
}
int main() {
cout << remove_vowels("adaddffg");
return 0;
}
/*This Kata is intended as a small challenge for my students
Create a function that takes a string argument and returns that same string with all vowels removed (vowels are "a", "e", "i", "o", "u").
Example (Input --> Output)
"drake" --> "drk"
"aeiou" --> ""
remove_vowels("drake") // => "drk"
remove_vowels("aeiou") // => ""
*/