got it thanks

want to count upper case 'A' and lower case 'a' separately or as a single character?

I would create an int array of 256 to represent all the possible characters in a text file. Actually that's more than is possible in a text file, but it makes the math easier. Then as you read each character you can let the character itself index into that array. For example, if the program reads the letter 'A'

int arry[256] = {0}; // declare the array

int c;
// read a single character
// increment the counter for that character

Put the above in a loop, when the reading is all done you have the sum for each letter. Just loop through that array and print the values that are greater than 0

for(int i = 0; i < 256; i++)
    if( arry[i] > 0)
        cout << "Letter " << (char)i << " = " << arry[i] << "\n";

You could also probably do this with <map> but the coding would be a little more difficult.

commented: definately a guru +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.