米缸虫

导航

16.2练习题

(a)

struct complex
{
double real, imaginary;

};
或者
trpedef struct
{
double real, imaginary;
}complex;

(b)

struct complex
{
double real, imaginary;

};
complex c1,c2,c3;

(c)

struct complex
{
double real,imaginary;

};

complex make_complex(double a, double b)
{
struct complex p;
return p;
};

(d)

struct complex
{
double real,imaginary;

}a,b;

complex add_complex(struct complex a, struct complex b)
{
struct complex p;
p.real = a.real+b.real;
p.imaginary = a.imaginary+b.imaginary;
return p;
};

posted on 2022-02-13 13:54  米缸虫  阅读(33)  评论(0编辑  收藏  举报