I need to create a program that outputs whether or not this is a vowel outputting if is true or false. Yet, everything is just outputting that it is not a vowel (output is 0 for letter 'a'.)
#include <fstream>
bool isVowel(char ch);
usingnamespace std;
int main()
{
ifstream inData;
ofstream outData;
char vowel;
inData.open("input.txt");
outData.open("output.txt");
inData >> vowel;
isVowel(vowel);
outData << "The letter tests << isVowel(vowel) << for a vowel. <<endl;
inData.close ();
outData.close();
system("pause");
return 0;
}
bool isVowel(char ch)
{
int value;
switch(ch)
{
case 'a' : case 'A':
value = 1;
break;
case 'e' : case 'E':
value = 1;
break;
case 'i' : case 'I':
value = 1;
break;
case 'o' : case 'O':
value = 1;
break;
case 'u' : case 'U':
value = 1;
break;
default:
value = 0;
}
return value;
}