463,405 views
14 votes
14 votes
Swapping Order of Vowels Write a program to swap the order of the vowels in a given word. For example, if the word is programming, the output is prigrammong. Here, the initial order of vowels is o, a, i which changes to i, a, o. Assume that the letters of the words are in lowercase.

User Fireitup
by
3.5k points

1 Answer

20 votes
20 votes

Answer:

Program is as follow:

Step-by-step explanation:

#include<iostream.h>

#include < conio.h>

bool isVowel(char b)

{

return

( b=='a' || b=='A' || b=='e' || b=='E' || b=='i' || b=='I' || b=='o' || b=='O' || b== 'u' || b=='U');

For swaoing the vowels

string reverseVowel ( String str)

{

int j = 0;

string v ;

for ( int i= 0 ; str [i]]!='0'; i++)

if( isv(str[i]))

v[j++] = str[i[;

for ( int i = 0; str[i]! = '0' ; i++

if ( isv (str[i]))

str{i} = v [--j]

return str;

}

int main ()

{ string str = " Programming";

cout<<swapv(str);

return 0 ;

}

User Rafael
by
3.5k points