青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

The Fourth Dimension Space

枯葉北風寒,忽然年以殘,念往昔,語默心酸。二十光陰無一物,韶光賤,寐難安; 不畏形影單,道途阻且慢,哪曲折,如渡飛湍。斬浪劈波酬壯志,同把酒,共言歡! -如夢令

復數類模板(Complex Class)

#include<iostream>
#include
<cmath>
using namespace std;


//本模板在VS2005下可正常運行
/**//*//////////////////////////////BEGIN_TEMPLATE_CALSS_COMPLEX_BY_ABILITYTAO////////////////////////////*/
class Complex
{
private:

    
void show();
    
double real;
    
double image;
public:

    Complex()
{real=0;image=0;}
    
~Complex(){}
    Complex(
double a,double b){real=a;image=b;}
    
double Getreal(){return real;}
    
double Getimage(){return image;}
    
double abs(){return sqrt(real*real+image*image);}
    Complex 
operator +(Complex &other);
    Complex 
operator +(const double &other);
    Complex 
operator +(const int &other);

    Complex 
operator -(Complex &other);
    Complex 
operator -(const double &other);
    Complex 
operator -(const int &other);

    Complex 
operator *(Complex &other);
    Complex 
operator *(const double &other);
    Complex 
operator *(const int &other);

    Complex 
operator /(Complex &other);
    Complex 
operator /(const double &other);
    Complex 
operator /(const int &other);

    
void operator +=(Complex &other);
    
void operator +=(const double &other);
    
void operator +=(const int &other);

    
void operator -=(Complex &other);
    
void operator -=(const double &other);
    
void operator -=(const int &other);

    
void operator *=(Complex &other);
    
void operator *=(const double &other);
    
void operator *=(const int &other);

    
void operator /=(Complex &other);
    
void operator /=(const double &other);
    
void operator /=(const int &other);

    Complex 
operator =(Complex &other);
    Complex 
operator =(const double &other);
    Complex 
operator =(const int &other);

    
bool operator ==(Complex &other);
    
bool operator ==(const double &other);
    
bool operator ==(const int &other);

    friend ostream
& operator<<(ostream &os,Complex &other);
    friend istream
& operator>>(istream &is,Complex &other);
}
;


void Complex::show()
{

    
if(real>0&&image<0)
        printf(
"%g%gj",real,image);
    
else if(real>0&&image>0)
        printf(
"%g+%gj",real,image);
    
else if(real<0&&image>0)
        printf(
"%g+%gj",real,image);
    
else if(real<0&&image<0)
        printf(
"%g%gj",real,image);
    
else if(real==0&&image!=0)
        printf(
"%gj",image);
    
else if(real!=0&&image==0)
        printf(
"%g",real);
    
else 
        printf(
"0");
}


Complex Complex::
operator+(Complex &other)
{
    Complex temp;
    temp.real
=real+other.real;
    temp.image
=image+other.image;
    
return temp;
}


Complex Complex::
operator +(const double &other)
{

    Complex temp;
    temp.real
=real+other;
    temp.image
=image;
    
return temp;
}


Complex Complex::
operator +(const int &other)
{
    Complex temp;
    temp.real
=real+(double)other;
    temp.image
=image;
    
return temp;
}



Complex Complex::
operator-(Complex &other)
{

    Complex temp;
    temp.real
=real-other.real;
    temp.image
=image-other.image;
    
return temp;
}


Complex Complex::
operator -(const double &other)
{

    Complex temp;
    temp.real
=real-(double)other;
    temp.image
=image;
    
return temp;
}


Complex Complex::
operator -(const int &other)
{

    Complex temp;
    temp.real
=real-(double)other;
    temp.image
=image;
    
return temp;
}

Complex Complex::
operator*(Complex &other)
{
    Complex temp;
    temp.real
=(real*other.real-image*other.image);
    temp.image
=(image*other.real+real*other.image);
    
return temp;


}


Complex Complex::
operator *(const double &other)
{
    Complex temp;
    temp.real
=real*other;
    temp.image
=image*other;
    
return temp;
}


Complex Complex::
operator *(const int &other)
{
    Complex temp;
    temp.real
=real*(double)other;
    temp.image
=image*(double)other;
    
return temp;
}


Complex Complex::
operator/(Complex &other)
{

    Complex temp;
    temp.real
=((real*other.real)+(image*other.image))/(other.real*other.real+other.image*other.image);
    temp.image
=((image*other.real)-(real*other.image))/(other.real*other.real+other.image*other.image);
    
return temp;

}


Complex Complex::
operator /(const double &other)
{
    Complex temp;
    temp.real
=real/other;
    temp.image
=image/other;
    
return temp;

}


Complex Complex::
operator /(const int &other)
{
    Complex temp;
    temp.real
=real/(double)other;
    temp.image
=image/(double)other;
    
return temp;
}





void Complex::operator+=(Complex &other)
{
    
this->real+=other.real;
    
this->image+=other.image;
}


void Complex::operator +=(const double &other)
{

    
this->real+=other;
}


void Complex::operator +=(const int&other)
{
    
this->real+=(double)other;
}






void Complex::operator-=(Complex &other)
{
    
this->real-=other.real;
    
this->image-=other.image;
}


void Complex::operator -=(const double &other)
{

    
this->real-=other;
}


void Complex::operator -=(const int &other)
{
    
this->real-=(double)other;
}




void Complex::operator*=(Complex &other)
{
    
this->real=(real*other.real-image*other.image);
    
this->image=(image*other.real+real*other.image);;
}


void Complex::operator *=(const double &other)
{

    
this->real=real*other;
    
this->image=image*other;
}


void Complex::operator *=(const int &other)
{
    
this->real=real*(double)other;
    
this->image=image*(double)other;
}



void Complex::operator/=(Complex &other)
{
    
this->real=((real*other.real)+(image*other.image))/(other.real*other.real+other.image*other.image);
    
this->image=((image*other.real)-(real*other.image))/(other.real*other.real+other.image*other.image);
}


void Complex::operator /=(const double &other)
{

    
this->real=real/other;
    
this->image=image/other;
}


void Complex::operator /=(const int &other)
{
    
this->real=real/(double)other;
    
this->image=image/(double)other;
}


Complex Complex::
operator= (Complex &other)
{

    
this->real=other.real;
    
this->image=other.image;
    
return *this;

}

Complex Complex::
operator =(const double &other)
{
    
this->real=other;
    
this->image=image;
    
return *this;


}

Complex Complex::
operator =(const int &other)
{
    
this->real=(double)other;
    
this->image=image;
    
return *this;
}



bool Complex::operator ==(Complex &other)
{

    
if(this->real=other.real&&this->image==other.image)
        
return true;
    
else return false;
}

bool Complex::operator ==(const double &other)
{

    
if(this->real==other&&this->image==0)
        
return true;
    
else 
        
return false;
}

bool Complex::operator ==(const int &other)
{
    
if(this->real==(double)other&&this->image==0)
        
return true;
    
else 
        
return false;
}


ostream
& operator<<(ostream &os,Complex &other)
{
    other.show();
    
return cout;
}


istream
& operator>>(istream &is,Complex &other)
{
    
is>>other.real;
    
is>>other.image;
    
return cin;
}

/**//**//**//////////////////////////////END_TEMPLATE_CLASS_COMPLEX///////////////////////////////









int main()
{
    Complex test1(
10,6);
    Complex test2(
5,3);
    cout
<<test1*test2<<endl;
    cout
<<test1+test2<<endl;
    cout
<<test1/test2<<endl;
    cout
<<test1-test2<<endl;
    
return 0;
}

posted on 2009-05-29 21:39 abilitytao 閱讀(1764) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            午夜国产一区| 国产精品www色诱视频| 亚洲国产欧美在线| 亚洲美女av黄| 国产精品观看| 亚洲在线视频一区| 久久躁日日躁aaaaxxxx| 亚洲激情在线观看| 欧美日韩中文在线观看| 午夜在线电影亚洲一区| 欧美成年人视频网站| 99国产一区| 国产欧美日本| 免费亚洲一区| 一区二区三区黄色| 久久精品免费看| 亚洲国产精品va在线看黑人| 欧美日韩国产精品一卡| 性欧美在线看片a免费观看| 嫩草影视亚洲| 欧美亚洲一级| 亚洲国产成人久久综合| 国产精品美女在线| 久久一区二区视频| 国产精品99久久久久久人| 久久久亚洲欧洲日产国码αv| 亚洲激精日韩激精欧美精品| 欧美午夜www高清视频| 久久精品国产亚洲精品| 99精品免费视频| 嫩草国产精品入口| 欧美亚洲网站| a4yy欧美一区二区三区| 禁断一区二区三区在线| 国产精品久久久久av| 久热精品视频在线观看一区| 亚洲一区三区在线观看| 欧美激情按摩在线| 久久人人超碰| 香蕉免费一区二区三区在线观看| 亚洲成人在线观看视频| 国产日韩精品一区二区| 欧美日韩在线电影| 麻豆成人在线播放| 久久精品免费电影| 亚洲欧美激情在线视频| 日韩视频三区| 亚洲欧洲精品一区二区三区不卡| 久久在线91| 久久九九99视频| 午夜久久tv| 亚洲影音一区| 一区二区三区高清视频在线观看| 亚洲国产导航| 精品二区久久| 有码中文亚洲精品| 国内外成人在线| 国产一级揄自揄精品视频| 国产精品黄视频| 国产精品国产三级国产a| 欧美喷水视频| 欧美了一区在线观看| 欧美福利小视频| 欧美寡妇偷汉性猛交| 免费av成人在线| 老**午夜毛片一区二区三区| 久久久精品免费视频| 香蕉久久一区二区不卡无毒影院| 亚洲欧美成人一区二区在线电影| 99国产欧美久久久精品| 日韩网站在线| 在线视频中文亚洲| 亚洲一区二区黄| 亚洲免费伊人电影在线观看av| 一区二区国产精品| 亚洲午夜在线观看视频在线| 中文精品视频| 亚洲欧美日韩网| 久久精品国产精品亚洲| 久久婷婷国产综合精品青草| 美女视频黄免费的久久| 欧美va亚洲va日韩∨a综合色| 蜜桃av一区二区| 欧美经典一区二区三区| 欧美精品一区二区三区蜜臀| 欧美日韩免费高清| 国产精品毛片在线| 国产性色一区二区| 在线观看视频一区二区| 亚洲国产精品毛片| 夜夜嗨一区二区三区| 亚洲欧美精品suv| 久久久久成人精品免费播放动漫| 狂野欧美激情性xxxx| 亚洲高清毛片| 亚洲一区在线播放| 久久精品国产久精国产思思| 欧美电影在线观看| 国产精品亚洲а∨天堂免在线| 国产日韩一级二级三级| 亚洲国产视频一区| 亚洲婷婷在线| 狂野欧美激情性xxxx| 亚洲日本黄色| 久久aⅴ国产紧身牛仔裤| 蜜桃视频一区| 国产精品久久久久久久久久直播 | 久久都是精品| 欧美精品一区二区在线观看| 国产精品www| 亚洲成人原创| 篠田优中文在线播放第一区| 免费中文字幕日韩欧美| 99精品热视频| 久久精品国产亚洲一区二区| 欧美日韩国产一级片| 海角社区69精品视频| 亚洲天堂男人| 亚洲第一精品电影| 欧美一区二区三区免费观看| 欧美精品在线一区二区| 激情av一区二区| 亚洲永久在线观看| 亚洲第一精品夜夜躁人人躁| 亚洲欧美日韩专区| 欧美日韩国产123区| 影音先锋在线一区| 欧美一区视频| 亚洲九九爱视频| 免费看成人av| 激情欧美亚洲| 欧美在线视频免费观看| 日韩午夜一区| 欧美激情亚洲视频| 亚洲国产精品999| 久久蜜桃香蕉精品一区二区三区| 99re66热这里只有精品4| 久久一区中文字幕| 韩国成人福利片在线播放| 香蕉成人久久| 一区二区三区日韩欧美精品| 欧美精品激情blacked18| 亚洲第一网站免费视频| 久久精品国产91精品亚洲| 亚洲少妇一区| 欧美日精品一区视频| 日韩视频不卡| 亚洲国产欧美一区二区三区同亚洲 | 女生裸体视频一区二区三区| 亚洲欧美国产77777| 国产精品vip| 亚洲免费影视第一页| 夜夜嗨av一区二区三区四季av | 欧美国产日产韩国视频| 久久九九久精品国产免费直播| 国产欧美韩日| 久久精品av麻豆的观看方式| 亚洲午夜久久久久久尤物 | 国产日韩欧美一区二区| 午夜激情一区| 亚洲欧美日韩在线播放| 国产精品自拍小视频| 欧美亚洲一区二区在线| 亚洲欧美怡红院| 国产午夜亚洲精品理论片色戒| 午夜精品视频一区| 西瓜成人精品人成网站| 国产午夜久久| 男男成人高潮片免费网站| 老鸭窝91久久精品色噜噜导演| 亚洲电影免费观看高清完整版在线观看 | 久久野战av| 日韩午夜电影av| 一区二区久久久久久| 国产精品日韩精品| 久久国产精品免费一区| 久久国产日韩欧美| 亚洲高清在线播放| 亚洲区国产区| 国产精品theporn| 欧美在线视频播放| 久久久水蜜桃av免费网站| 亚洲啪啪91| 一区二区三区四区国产精品| 国产欧美日韩亚洲精品| 欧美va天堂在线| 欧美日韩国产丝袜另类| 欧美在线视频不卡| 狼人社综合社区| 亚洲伊人色欲综合网| 欧美一区影院| 99国产精品视频免费观看| 亚洲一区二区成人| 在线成人国产| 一区二区免费在线播放| 国产一区二区三区在线观看免费视频 | 欧美日韩中国免费专区在线看| 亚洲影院色在线观看免费| 欧美亚洲综合在线| 亚洲人成人一区二区在线观看|