Answer to Question #38171 in C++ for ephrem moges

Question #38171
develop a c++ program that accepts the name of a person that should replace vowel characters with * in the person name.
1
Expert's answer
2017-04-04T08:24:03-0400
#include <iostream>
#include <string>

using namespace std;

int main ()
{
string Name;
cout<<"Enter name : ";
getline (cin, Name);

for (int i = 0; i < Name.length(); i++)
{
char buf = tolower(Name[i]);
if ( buf == 'a' || buf == 'e' || buf == 'i' || buf == 'o' || buf == 'u' || buf == 'y')
Name[i] = '*';
}
cout <<"After processing : "<< Name;
cin.get (); //wait fo "Enter"
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS