In this article I would like to share with you a sample program that I wrote a long time ago in my class in C++ programming I called this program Vowel Omitter. What this program will do is to ask the user to enter a sentence and then the program will remove or omit all the vowels that can be found in the words in the given sentence. I used this program to show my students in my class that C++ has many features that are suitable in string manipulation not just solving numbers.
Thank you very much.
Sample Output of Our Program
Program Listing
using namespace std;
int x=0,j=0, y=0,vow=0;
int countedw(char str[150]);
main()
{
char str[150];
cout << "\n\n \t VOWEL OMITTER ";
cout << "\n\n Created By: Mr. Jake R. Pomperada, MAED-IT";
cout << "\n\n";
cout << "Type a Sentence :=> ";
gets(str);
cout << "\n\n";
cout <<"\nOriginal Words: " <<str ;
cout<< "\n\nRemaining letters: ";
countedw(str);
cout <<"\n\nTotal No. of Omitted Vowels: " <<vow;
cout << "\n\n";
system("pause");
}
int countedw(char str[150])
{
char tmp,tmp1;
y=strlen(str);
for(x=0; x<=y; x++)
{
tmp=str[x];
if (tmp!='a'&&tmp!='A'&&tmp!='e'&&tmp!='E'&&tmp!='i'&&tmp!='E'&&tmp!='o'&&tmp!='O'&&tmp!='u'&&tmp!='U' )
{
tmp1=tmp;
cout << tmp1;
}else{
vow++;
}
}
}
DOWNLOAD FILE HERE