hii everyone ^^
My project for the c++ course is due tomorrow
but am facing a problem
this is the function
int i=0,x , ar[100];
double a_d,y=1;
cin>>a_d;
while (y!=0)
{
y=a_d*10;
x=static_cast<int> (y)%10;
cout<<endl<<"after "<<y<<endl<<"the number "<<x;
a_d=y-x;
i++;
}
cout<<i;
return 0 ;
}
what I wanna do with the previose code is that
the user will enter a rational number
let say .001011 ( binary )
then the code will devied it into integers ( 0 0 1 0 1 1 )
and fill each subarray of arr with each number
ex
arr[0]=0;
arr[1]=0;
arr[2]=1;
but for some reason when I run it the program gives an inifint loop
( am doing this so I can later convert it from decimal to binary )
thanx ^^