1. Thank you everybody, I got it to work. finally.

2. ## Question. by Peter.

Hello, I have a question guys, I dont know why my teacher asked me this , but i want to make sure is right, would you be able to help me. ? thank you , I really appreciated.

heres my code
Code:
```const int numLetter = 26;

struct letterFrequency
{
int freq;
char letter;
};

int indexOfLargest(letterFrequency freqArray[], int startingPoint);

void countLetters(letterFrequency freqArray[]);
void initFreqArray(letterFrequency freqArray[]);    // arrays.
void printFreqTable(letterFrequency freqArray[]);
void sortFreqArray(letterFrequency freqArray[]);

int main()
{
letterFrequency freqArray[numLetter];

initFreqArray(freqArray);
countLetters(freqArray);
sortFreqArray(freqArray);
printFreqTable(freqArray);

}

void initFreqArray(letterFrequency freqArray[])

{
for (int count = 0; count < numLetter; count++)
{
freqArray[count].freq = 0;
freqArray[count].letter = 'a' + count;
}
}

void countLetters(letterFrequency freqArray[])
{
char ch;

cout << "Enter a sequence of characters (end with a period '.'): ";
cin.get(ch);

while (ch != '.')
{
if (isalpha(ch))
{
freqArray[tolower(ch) - 'a'].freq++;
}
cin.get(ch);
}
}

void sortFreqArray(letterFrequency freqArray[])
{
for (int count = 0; count < numLetter - 1; count++)
{
swap(freqArray[indexOfLargest(freqArray, count)],
freqArray[count]);
}
}

int indexOfLargest(letterFrequency freqArray[], int startingPoint)
{
int indexOfLargest = startingPoint;
for (int count = startingPoint + 1; count < numLetter; count++)
{
if (freqArray[count].freq > freqArray[indexOfLargest].freq)
{
indexOfLargest = count;
}
}
return indexOfLargest;
}

void printFreqTable(letterFrequency freqArray[])
{
int count = 0;

cout << "Letter:" << setw(4) << "" << "Number of Occurrences" << endl;

while (freqArray[count].freq != 0 && count < numLetter)
{
cout << setw(4) << freqArray[count].letter << setw(16)
<< freqArray[count].freq << endl;
count++;
}

system ("PAUSE");

}
and here is the question :

(1) Could you explain what is happening in the source code below if someone types cAt in The hat. xyz

while (ch != '.')
{
if (isalpha(ch))
{
freqArray[tolower(ch) - 'a'].freq++;
}
cin.get(ch);
}
}```
Please be specific and let me know what is occurring in the freqArray struct.

and

Could you explain why you used the following condition in the while loop?

while (freqArray[count].freq != 0 && count < numLetter)

3. 1. So be the computer. You've got the code. Run through it line by line; when you need input you know what the user will type in.

2. Why did you use that condition in your while loop?

3. What does this have to do with fractions?