E
emre esirik(hacettepe computer science and enginee
/////////////////////// DIVISION FUNCTION ////////////////////
void div ( int pol1[] , int pol1p[] , int pol2[] , int pol2p[])
{
int r=5,z,i,g,j,k,l,dividend[6],rising[6]={0};
for (i=0 ; i<6 ; i++)
dividend=pol1;
for(i=5 ; i >=0 ; i--)
{
r=5;
for(z=r ; z>=0 ; z--)
{
if(pol2[z]!=0)
{
*(po5 + (i-z))= dividend/pol2[z];
for(l=0; l<6; l++)
rising[l]=0;
for (j=z ; j>=0 ; j--) {
rising[i+j-z] = (*(po5 + i-z) * pol2[j]);
}
for(k=0; k<6 ; k++) {
dividend[k] = dividend[k] - rising[k];
}
}
r=z-1;
}
}
for (i=0 ; i<6 ; i++) {
printf("%dX^%d+",*(po5+i),i);
}
when first poly is like 3X^2 and second poly is like 1X its work
right, but it divides other poly wrongly, I couldnt find,helppp me
pleaseee
void div ( int pol1[] , int pol1p[] , int pol2[] , int pol2p[])
{
int r=5,z,i,g,j,k,l,dividend[6],rising[6]={0};
for (i=0 ; i<6 ; i++)
dividend=pol1;
for(i=5 ; i >=0 ; i--)
{
r=5;
for(z=r ; z>=0 ; z--)
{
if(pol2[z]!=0)
{
*(po5 + (i-z))= dividend/pol2[z];
for(l=0; l<6; l++)
rising[l]=0;
for (j=z ; j>=0 ; j--) {
rising[i+j-z] = (*(po5 + i-z) * pol2[j]);
}
for(k=0; k<6 ; k++) {
dividend[k] = dividend[k] - rising[k];
}
}
r=z-1;
}
}
for (i=0 ; i<6 ; i++) {
printf("%dX^%d+",*(po5+i),i);
}
when first poly is like 3X^2 and second poly is like 1X its work
right, but it divides other poly wrongly, I couldnt find,helppp me
pleaseee