C/C++の宿題を片付けます 117代目at TECH
C/C++の宿題を片付けます 117代目 - 暇つぶし2ch846:デフォルトの名無しさん
08/11/15 14:11:56
>>843
struct mycomplex wa(struct mycomplex a, struct mycomplex b)
{
struct mycomplex z = { a.re+b.re, a.im+b.im };
return z;
}

struct mycomplex sa(struct mycomplex a, struct mycomplex b)
{
struct mycomplex z = { a.re-b.re, a.im-b.im };
return z;
}

struct mycomplex seki(struct mycomplex a, struct mycomplex b)
{
struct mycomplex z = { a.re*b.re - a.im*b.im, a.re*b.im + a.im*b.re };
return z;
}

struct mycomplex shou(struct mycomplex a, struct mycomplex b)
{
struct mycomplex z = {
(a.re*b.re + a.im*b.im) / (b.re*b.re + b.im*b.im),
(a.im*b.re - a.re*b.im) / (b.re*b.re + b.im*b.im)
};
return z;
}

double cabs(struct mycomplex a)
{
return hypot(a.re, a.im);
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch