So i'm trying to write a program that counts vowels and tells the user how many vowels they entered and how many consonants they entered. problem is my answer returns some weird stuff.
side note : I have to use char can't be a string.
side note 2: By counting chars I mean abc equals 3, abcd = 4, ... but I want this in vowels and consonants.
//Programed by : Jackelinblack
//Program that uses a value returining function to let the user know
//if a certain charecter is a vowel and output how many vowels and non vowels
// have been entered.
#include <iostream>
usingnamespace std;
// function prototype
bool issvowel (char);
int main() {
char vowels , notVowel;
char v = 0 , n = 0;
char isvowel;
cout << "Enter a character " << endl;
//cin >> vowels;
isvowel = issvowel(isvowel);
while (issvowel (isvowel)){
if (isvowel == true)
{
cout << "Enter a vowel " << endl;
cin >> vowels;
v++;
}
//Don't think the code even reaches this point.
else
{
cout << "Enter another character " << endl;
cin >> notVowel;
n++;
}
cout << "you entered " << v << " vowels and " << n << " consonates " << endl;
}
return 0;
}
bool issvowel (char isvowel)
{
if (isvowel == 'a' || isvowel == 'e' || isvowel == 'i' || isvowel == 'o' || isvowel == 'u')
{
isvowel = true;
return isvowel;
}
else{
isvowel = false;
return isvowel;
}
}