Here is my code so far:
// This program promts user to enter a string and then returns
// the number of vowels, consonants, and characters in the string.
#include <iostream>
#include <cstring>
int vowel_count (int i, int vow);
int consontant_count (int i, int cons);
using namespace std;
int main()
{
string str;
// Promt user to enter string
cout <<"Enter a String: '\n'";
getline (cin, str);
cout << "You entered: "<< str<< endl;
// C-String Output
cout <<"This has " << str.length();
Line 30 cout <<"characters," << int vowel_count(str);
cout <<"vowels and " << int consontant_count(str);
cout <<"consonants" <<endl;
cout <<endl;
// String Data Type Output
cout <<"This has " << str.length();
cout <<"characters," << int vowel_count();
cout <<"vowels and " << int consontant_count();
cout <<"consonants" <<endl;
cout <<end;
}
int vowel_count ()
{
int vow
for(int i = 0; i < str.length(); i )
{
if(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u'
str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U')
vow ;
return vow;
}
}
int consontant_count ()
{
int cons
for(int i = 0; i < str.length();)
{
if(str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u'
str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U')
i ;
else
cons || i ;
return cons;
}
system("PAUSE");
return 0;
}
Tags: