So one of the prompt of my lab is: "Find the percentage of vowels and percentage consonants in the English language. You should get a percentage of vowels = 37.4% and consonants = 62.5%."
Here is just my percentage function. I think there may be something wrong with the for loops but I can't seem to figure it out.. Thanks for the help!
int pv(string w) {
double numC=0;
double numV=0;
string fName;
ifstream inFile;
double pc;
cout << "Enter file name of dictionary (Mac users type in full path): ";
cin >> fName;
if (inFile.fail()) {
cout << "Error opening file" << endl;
exit(1);
}
while (!inFile.eof()) {
getline(inFile, w);
for (int i=0; i<w.length(); i++) {
if(w[i]==('a')||w[i]==('e')||w[i]==('i')||w[i]==('o')||w[i]==('u'))
numV=numV+1;
else {
numC=numC+1;
}
}
}
cout << numV;
return 0;
}