At last, here is the code that works:
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <Windows.h>
using namespace std;
bool checkBuffer( char buffArray[], int buffSize );
void parseBuffer( char alphaArray[], char buffArray[], int alphaSize, int buffSize );
int main()
{
char alphabetArray[]= "abcdefghijklmnopqrstuvwxyz";
char buffer[11];
cout << "Enter the string up to 10 letters." << endl;
cin.get(buffer, strlen(buffer) );
checkBuffer(buffer, sizeof(buffer) );
parseBuffer( alphabetArray, buffer, sizeof(alphabetArray), sizeof(buffer) );
system("Pause");
return 0;
}
bool checkBuffer( char buffArray[], int buffSize )
{
if(buffArray, strlen(buffArray) == 0)
{
cout << "The buffer is empty. The program will end in 3 seconds. " << endl;
Sleep(3000);
exit(1);
}
}
void parseBuffer( char alphaArray[], char buffArray[], int sizeOne, int sizeTwo )
{
int countFreq = 0;
for(int i = 0; i < strlen(alphaArray); i++ )
{
countFreq = 0;
for(int j = 0; j < strlen(buffArray); j++)
{
if( alphaArray[i] == buffArray[j] )
countFreq = countFreq + 1;
}
cout << "The letter " << alphaArray[i] << " matched " << countFreq
<< " times." << endl;
}
}
#includ