1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include <string.h> #include <math.h> #include "dec2oct.h" #include <stdio.h> void ddec2octs(double in,double* out) { int i=0,j=0,tmp=0; int quotient; quotient=(int)in; while(quotient!=0) { out[i++]= quotient%8; quotient=quotient/8; } j=i-1; i=0; while(i<j) { tmp=out[i]; out[i]=out[j]; out[j]=tmp; i++; j--; } }