C++ question... help please.

Status
Not open for further replies.

0

Ars Scholae Palatinae
609
code:<HR>
Code:
Pseudocode:<P>int counters[10];
int totalCount = 0;<P>for each number in file
{
    counters[(int)(currentReadInNumber / 10)]++;
    totalCount++;
}

The first line in the loop will increment the counter for the related range via the magic of integer math in C. The second line gives you a total count. The percentages are simply the ratio of each counter to the total count after all that.
 
Status
Not open for further replies.