In my programming class we were given a problem to do, which is to prompt the user to input a sequence of characters and output the number of vowels. I did all of that and my code worked perfectly but then my professor added additional requirements. Now i have to use input and output files as well as the functions read and print. Now I'm just a little confused about how to use the read and print functions and I'm having trouble getting the result to show up in my output file. (P.S. for the read and print functions i know I only have the prototypes listed)
cout << "Enter a sequence of characters or a sentence" << endl;
getline(inFile, phrase);
int count = 0, i;
for (i = 0; i < phrase.length(); i++)
{
if (DeterminIfVowel(phrase[i]))
count++;
}
outFile << "There are " << count << "vowels in " << phrase << endl;
system("pause");
inFile.close();
outFile.close();
return 0;
}
bool DeterminIfVowel(char c)
{
return (c == 'a' || c == 'A' || c == 'e' || c == 'E' || c == 'i' || c == 'I' || c == 'o' || c == 'O' || c == 'u' || c == 'U');
}