代码错误(操作数无效)

时间:2015-10-22 08:26:08

标签: c++ compiler-errors

我遇到以下错误:

  

错误无效式操作数类型-INT和 - float到二进制运算符的-

这是我的代码:

void DivComplex(float ,float, float ,float ) {

    const float divRe,divIm;

    cout << "Enter 2 complex numbers: " << endl;
    cin >> r1 >> i1 >> r2 >> i2;

    divRe = (r1*i1 + r2*i2)/(i1^2 + i2^2);
    divIm = (i1*r2 + r1*i2)/(i1^2 + i2^2);
    if(divIm < 0) {
        cout << "Devide is" << divRe << divIm << "j" << endl;
    }
    else {
        cout << "Devide is " << divRe << "+" << divIm << "j" << endl;
    }
}
};

0 个答案:

没有答案