This is a part of the code not working properly, i first converted an array integer (containing a binary value) to an integer and convert it into an octal value: here is the code: Note: this section of code does not give an output at all.
/****************************************
CONVERSION FROM DECIMAL TO OCTAL(DOUBLE)
*****************************************/
//we convert the binary valuie to octal value
int temp = 0;
double number_binary_copy = 0;
// conerts integer array to integer;
for(int z=0; z < 64; z++)
{
temp =binary_double[z];
number_binary_copy += temp;
number_binary_copy *= 10;
}
cout <<number_binary_copy <<endl;
long int number_binary = number_binary_copy;
int v=0,w[5],x=0;
while(number_binary!=0)
{
w[v]= number_binary %1000;
number_binary= number_binary/1000;
if(w[v]>111)
x=1;
v++;
}
v--;
if(x==0)
for(;v>=0;v--)
{
switch(w[v])
{
case 0:
cout<<"0";
break;
case 1:
cout<<"1";
break;
case 10:
cout<<"2";
break;
case 11:
cout<<"3";
break;
case 100:
cout<<"4";
break;
case 101:
cout<<"5";;
break;
case 110:
cout<<"6";
break;
case 111:
cout<<"7";
break;
}
}
Any help would be greatly appreciated.