Introductory Assignment – Something to get you started
log(count_c)
power_c = ceil( ------------------)
log(2)
log(count_d)
power_d = ceil( ------------------)
log(2)
note: ceil() and log() are functions included in "math.h". Power_c and power_d should be equal. You should check that this is the case. We will therefore use just power_c for the rest of our computations.
number = pow(2, power_c)
If the count_d < number, you need to put (number – count_d) more 999 into "fileD.dat", for example: if number=16 and count_d=11, you need to add 5 more 999 into file "fileD.dat". Then close this file.