#include #include #include #include using namespace std; const size_t MAX_LETTERS = 26; void InitArray(int ary[]); void CountLetters( int letterCount[], string filename); void PrintLetters(int letterCount[]); int main() { int letterCount[MAX_LETTERS]{}; InitArray(letterCount); CountLetters(letterCount, "message.txt"); PrintLetters(letterCount); return 0; } void InitArray(int ary[]){ size_t i; for(i=0;i> c; while(inFile) { if(isalpha(c)) { pos = tolower(c) - 'a'; //cout << "Changing the array at " << c // << " or " << static_cast(pos) << endl; letterCount[pos]++; } inFile >> c; } inFile.close(); return; }