Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 23f54da

Browse files
authored
Create 04 Reverse the vowels.cpp
1 parent 8563aa3 commit 23f54da

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
bool isVowel(char c)
4+
{
5+
return (c=='a' || c=='A' || c=='e' ||
6+
c=='E' || c=='i' || c=='I' ||
7+
c=='o' || c=='O' || c=='u' ||
8+
c=='U');
9+
}
10+
string reverseVowel(string str)
11+
{
12+
int j=0;
13+
string vowel;
14+
for (int i=0; str[i]!='0円'; i++)
15+
if (isVowel(str[i]))
16+
vowel[j++] = str[i];
17+
for (int i=0; str[i]!='0円'; i++)
18+
if (isVowel(str[i]))
19+
str[i] = vowel[--j] ;
20+
21+
return str;
22+
}
23+
int main()
24+
{
25+
string str;
26+
cin>>str;
27+
cout << reverseVowel(str);
28+
return 0;
29+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /