rendered paste body//Attached: HW_9a,9b,9c
//===================================
//File:hw_9c.cpp
//====================================
//Programmer: Chris Anderson
//Date: May 14 2007
//Class:cs121
//Time : Wenesday 7:00pm
//Instructor : Dennis Rainey
//Description: Programs prompts the user with a sentence to enter then, reads the sentence and prints out the vowels in the sentence.
//
//
//====================================
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
/////////////////////////////////////////////
//function prototypes
/////////////////////////////////////////////
char GetSentence(char & character);
void IsVowel(char & character);
/////////////////////////////////////////////
//main
/////////////////////////////////////////////
int main ()
{
float num = 0;
char character;
GetSentence(character);
cout << "Vowels: ";
while(cin.get(character))
{
IsVowel(character);
}
cout << "There are " << num << "vowels in this sentence";
return 0;
}
/////////////////////////////////////////////
//function definitions
/////////////////////////////////////////////
char GetSentence(char & character)
{
cout << "Please Enter a Sentence of which you desire: ";
cin >> character;
return character;
}
void IsVowel(char & character)
{
if(character == 'a')
{
cout << "a,";
//num++;
}
else if (character == 'e')
{
cout << "e,";
//num++;
}
else if (character == 'i')
{
cout << "i,";
//num++;
}
else if (character == 'o')
{
cout << "o,";
//num++;
}
else if (character == 'u')
{
cout << "u,";
//num++;
}
}