First of all:
16-bit numbers requires 4 hex characters.
32-bit numbers requires 8 hex characters.
64-bit numbers requires 16 hex characters.
Either you are not generating 64-bit numbers, or you are using the wrong
with in the formatting string.
Second, the MinGW tool uses parts of M$ libraries, i.e. 64-bit numbers are
emitted using %I64d/%I64u/%I64x. You are specifying %lX, which represents
long integers. For a 32-bit compiler, long is normally also 32-bit (same
as int), and to get 64-bit numbers you normally have to write long long,
or __int64.
Third: For such a trivial set of numbers - only 15000 - duplicates are
trivially counted by allocating an array to hold all generated numbers.
Then sort the array, and walk through it to count number of instances of
each generated value.
/pwm
On Thu, 26 Apr 2007, Pablo Itaim A. wrote:
> Hi,
>
> I'm working with an application that generate N (1<N<15000) 64 bits numbers in hexadecimal format (%08lX - %08lX) and save it in a .txt file. Some numbers repeats more than ones, so my problem is that i want to know which of the numbers in the file repeats most and how many times.
>
> Can someboby help me?
>
> Thank you
>
> Best regards
>
> Pablo
>
|