complex类

#include 
#include 
using namespace std;

int main()
{
    complex a, b, c;
    cin >> a >> b >> c;
    complex dis = b * b - 4.0 * a * c, r1, r2;
    r1 = (-b + sqrt(dis)) / (2.0 * a);
    r1 = (-b - sqrt(dis)) / (2.0 * a);
    cout << "r1: " << r1 << endl;
    cout << "r2: " << r2 << endl;
    return 0;
}

你可能感兴趣的:(complex类)