float

#include<iostream>
using namespace std;
typedef struct plural{
    double a;
    double b;
};
int main()
{
    double product(double c,double d);
    plural product(plural e,plural f);    
    double c,d;
    plural e,f,g;
    cout << "请输入两个实数:" << endl;
    cin >> c >> d;
    cout << "请输入两个复数的实数部分:" << endl;
    cin >> e.a >> f.a;
    cout << "请输入两个复数的虚数部分:" << endl;
    cin >> e.b >> f.b;
    g = product(e,f);
    cout << product(c,d) << endl;
    cout << g.a << "+" << g.b << "i" << endl;
    return 0;
}
double product(double c,double d)
{
    return c*d;
}
plural product(plural e,plural f)
{
    plural h;
    h.a = e.a * f.a - e.b * f.b;
    h.b = e.b * f.a + e.a * f.b;
    return h;
}

 

posted on 2013-12-26 16:56  了发发  阅读(185)  评论(0)    收藏  举报

导航