Need help with counting vowels prog
ok so i have to write a program that counts the # of vowels from the file. my only problem is i know how to get the total but i cant figure out how to get the total number of a/A's, e/E's, and so on. need help asap.....the following is what i have so far:
Code:
#include <iostream>
#include<fstream>
using namespace std;
int main( )
{
ifstream inFile;
char c;
int nNum = 0;
inFile.open("j://cppproj 3.txt");
while(!inFile.eof())
{
inFile.get(c);
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
nNum++;
}
inFile.close();
cout << "The total number of vowels is " << nNum << ".\n";
return 0;
}