You may use switch case and for loop for simplicity.
using namespace std;
#include<iostream>
int main()
{
string a;
cin>>a;
for(int i=0;a[i]!='\0';i++)
{
switch (a[i])
{
case 'a':a[i]='.';
break;
case 'e':a[i]='.';
break;
case 'i':a[i]='.';
break;
case 'o':a[i]='.';
break;
case 'u':a[i]='.';
break;
}
}
cout<<a;
}
6
solved How to replace vowel letters with a character? [duplicate]