1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
#include <iostream>
#include <string>
#include <fstream>
#include <stdio.h>
#include <ctype.h>
using namespace std;
int main()
{
char curLetter, v[500];
int a, i, len, vA, vE, vI, vO, vU, vY, totV;
a=0, vA=0, vE=0, vI=0, vO=0, vU=0, vY=0, totV=0;
len=strlen(v);
ifstream infile;
infile.open("c:\\1.txt");
if (!infile)
cout << "NO INPUT FILE!!!" << endl;
while ((v[a++]=infile.get()) != EOF)a;
{
for (i=0; i < len; ++i)
{
curLetter = (toupper(v[i]));
if (curLetter = 'A')
{
vA++;
totV++;
}
else if (curLetter = 'E')
{
vE++;
totV++;
}
else if (curLetter = 'I')
{
vI++;
totV++;
}
else if (curLetter = 'O')
{
vO++;
totV++;
}
else if (curLetter = 'U')
{ vU++;
totV++;
}
else if (curLetter = 'Y')
{
vY++;
totV++;
}
}
}
cout << "Total Vowels: " << totV;
cout << "\nTotal A: " << vA;
cout << "\nTotal E: " << vE;
cout << "\nTotal I: " << vI;
cout << "\nTotal O: " << vO;
cout << "\nTotal U: " << vU;
cout << "\nTotal Y: " << vY << endl;
//infile.close();
return 0;
}
|