关于multiplies的结果
typedef complex<double> com;
multiplies<com> complexMultiplies;
cval1=(1.0,0);
cval2=(2.0,0);
cres=complexMultiplies(cval1,cval2);
cout<<cres<<endl;
cres的结果怎么是(0,0);
完全看不懂你要说什么?你能给出一些更全的代码吗?
比如complexmultiplies(cval1,cval2);
不好意思啊,是我没说清楚,给你带来德不便请原谅:)下面是全部代码
int main(void)
{
complex<double> cval1,cval2,cres;
typedef complex<double> com;
multiplies<com> complexMultiplies;
cval1=(1.0,0);
cval2=(2.0,0);
cres=complexMultiplies(cval1,cval2);
cout<<cres<<endl;
return 0;
}
使用multiplies<type>,把复数cval1=1.0和复数cval2=2.0,相乘,结果应该是2.0吧,可为什么,运行结果是(0.0,0.0)?
是不是我的multiplies<type>没用对啊,我定义的type是complex<double>。
谢谢:)