| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 385 人关注过本帖
标题:[求助]找错,谢谢
只看楼主 加入收藏
风中枫叶
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2006-6-24
收藏
 问题点数:0 回复次数:3 
[求助]找错,谢谢

POLY *exception(ha,hb)
POLY *ha,*hb;
{
POLY *hc,*pA,*pB,*pAp,*pC,*pCp,*pT,*pD;
int COUNT=0;
hc=NEW;
hc->next=hc;
pCp=hc;
while(1)
{
COUNT++;
pC=NEW;
pAp=ha;
ha->coef=-9999999;
ha->exp=-9999999;
pA=pAp->next;
pB=hb->next;
if(pA->exp>=pB->exp)
{
pC->exp=pA->exp-pB->exp;
pC->coef=pA->coef*pB->coefs;
pC->coefs=pA->coefs*pB->coef;
}
else
{
free(pC);
break;
}
pCp->next=pC;
pCp=pCp->next;
pCp->next=hc;
pD=pA;
pA=pA->next;
pAp->next=pA;
pB=pB->next;
free(pD);
while(pB!=hb)
{
if(pA->exp>(pB->exp+pC->exp))
{
while(pA->next->exp>(pB->exp+pC->exp))
pA=pA->next;
if(pA->next->exp==(pB->exp+pC->exp))
{pA->next->coef=pA->next->coef-(pB->coef*pC->coef);
if(pA->next->coef==0)
{
pD=pA->next;
pA->next=pA->next->next;
free(pD);
}
}
else
{
pT=NEW;
pT->exp=pB->exp+pC->exp;
pT->coef=-pB->coef*pC->coef;
pT->coefs=pB->coefs*pC->coefs;
pT->next=pA->next;
pA->next=pT;
}
pA=pAp->next;
}
else if(pA->exp==(pB->exp+pC->exp))
{
pA->exp=pA->exp;
pA->coef=pA->coef*pB->coefs*pC->coefs-pA->coefs*pB->coef*pC->coef;
pA->coefs=pA->coefs*pB->coefs*pC->coefs;
}
else if(pA->exp<(pB->exp+pC->exp))
{
pT=NEW;
pT->exp=pB->exp+pC->exp;
pT->coef=-pB->coef*pC->coef;
pT->coef=-pB->coefs*pC->coefs;
pT->next=pA; /*copy *pB to ha*/
pAp->next=pT;
pAp=pT;
}
if(pA->coef==0)
{
pD=pA;
pA=pA->next;
pAp->next=pA;
free(pD);
}
else
{
pAp=pA;
pA=pA->next;
}
pB=pB->next;
}
pB=hb->next;
pA=ha->next;
pAp=ha;
printf("This is the %d turn\n",COUNT);
printf("The result poly is:\n");
print_poly(hc);
printf("The poly A is:\n");
print_poly(ha);
}
return(hc);
}

2006-06-29 11:14
走刀口→超
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5018
专家分:0
注 册:2006-3-14
收藏
得分:0 
什么都没有。找个毛呀
就连头文件都米!

还很混乱哟~~~

[此贴子已经被作者于2006-6-29 11:28:59编辑过]


人在江湖【走】,怎能不挨【刀】;为了能活【口】,唯有把己【超】!come on...
2006-06-29 11:28
风中枫叶
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2006-6-24
收藏
得分:0 
就是看一下那个循环有没有错

男子汉,大丈夫,就应该找个女的温柔温柔!^_^ 有时间来这里看看: http://blog./user1/104/
2006-06-29 11:55
恋红尘
Rank: 1
等 级:新手上路
帖 子:47
专家分:0
注 册:2006-6-10
收藏
得分:0 
头都大了。先运行下然后把错误的行标注下然后发出来。光这样看你发出来的实在看的眼睛都花!
2006-06-29 22:03
快速回复:[求助]找错,谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.020536 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved