Showing posts with label vowel omitter. Show all posts
Showing posts with label vowel omitter. Show all posts

Saturday, August 30, 2014

Vowel Omitter in C++

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.

If you have some questions about my work please send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.

Thank you very much.


Sample Output of Our Program

Program Listing

#include <iostream>

 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