From: emre esirik(hacettepe com. sci. and eng.) on
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[i]=pol1[i];
for(i=5 ; i >=0 ; i--)
{
r=5;
for(z=r ; z>=0 ; z--)
{

if(pol2[z]!=0)
{
*(po5 + (i-z))= dividend[i]/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);
}
}

I need to poly divice, but it doesnt work rightly, I couldnt find the
wrong, is there anybody help mee pleaseee, urgently
From: Ulrich Eckhardt on
emre esirik(hacettepe com. sci. and eng.) wrote:
> void div ( int pol1[] , int pol1p[] , int pol2[] , int pol2p[])
[...]

Beware! There already is a global function called 'div', declared in
stdlib.h which might conflict with yours.

> I need to poly divice, but it doesnt work rightly, I couldnt find the
> wrong, is there anybody help mee pleaseee, urgently

Use a debugger to step through it. You can inspect variables with it and
then find the place when the results fail to match your expectations. Other
than that, if your homework or job is soo urgent, you might consider hiring
someone that knows how to do it. Other than that, provide a minimal but
complete example, explain what you found and what you expected.

In any case, here are some specific hints: I noticed that the last loop in
the function used some incorrect indention. Further, your code is using
something called 'po5', which I can't find in the function. Typically, you
are using something like '*(po5+i)'. If this thing is a pointer or an
array, you can also use the easier syntax 'po5[i]', the two should be
completely equivalent.

cheers

Uli

From: emre esirik(hacettepe com. sci. and eng.) on
thank you but still I couldnt find, po5 is a pointer and its getting
pol1 cofficient,
code is
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[i]=pol1[i];
for(i=5 ; i >=0 ; i--)
{
r=5;
for(z=r ; z>=0 ; z--)
{

if(pol2[z]!=0)
{
*(po5 + (i-z))= dividend[i]/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]);
dividend[i+j-z] = dividend[i+j-z] - rising[i+j-z];

}
}
r=z-1;
}
}

is there anybody have a idea of why it isnt correct??????
From: Ulrich Eckhardt on
emre esirik(hacettepe com. sci. and eng.) wrote:
> thank you but still I couldnt find, po5 is a pointer and its getting
> pol1 cofficient,

Okay.

> code is
> void div ( int pol1[] , int pol1p[] , int pol2[] , int pol2p[])

Dude, what did I tell you about the use of 'div'? What did I tell you about
things YOU need to provide for anyone to help? Please go and reread what I
wrote!

> is there anybody have a idea of why it isnt correct??????

Nobody here even has an idea of what correct means in this context and how
this incorrect looks like, because you didn't even provide a complete and
minimal but compilable example!

Uli

From: Bart van Ingen Schenau on
emre esirik(hacettepe com. sci. and eng.) wrote:

> thank you but still I couldnt find, po5 is a pointer and its getting
> pol1 cofficient,
> code is
<snip>
> is there anybody have a idea of why it isnt correct??????

You are giving us too little information to be able to answer your
question.

To make a good analysis of what is going wrong, we need all of the items
below:
- A minimal but complete program that shows your problem. It must be a
complete program, because we must be able to reproduce your results on
our own machine. It should be minimal to avoid distraction with side
issues.
So a single function, like you posted, is not enough. We must be able to
copy/paste the code into our compilers and get the same results you
get.

- A description of the results you are seeing. This is needed to verify
that we see the same results.

- A description of the results you expected. Without knowing the
expected results, it is not possible to tell where things start to go
wrong.

Bart v Ingen Schenau
--
a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq
c.l.c FAQ: http://c-faq.com/
c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/