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

The Fourth Dimension Space

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

復(fù)數(shù)類模板final(6.0下可用)

#include<iostream.h>
#include
<cstdio>
#include
<cmath>

//本模板在VC6.0下可正常運(yùn)行
//注意,想6.0支持友元函數(shù),需要使用iostream.h并去掉using namespace std;聲明進(jìn)行編譯。
/*//////////////////////////////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:49 abilitytao 閱讀(249) 評(píng)論(0)  編輯 收藏 引用


只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   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>
            国产一区观看| 国产精品xxxav免费视频| 亚洲精品国产精品国自产观看| 嫩草伊人久久精品少妇av杨幂| 欧美另类极品videosbest最新版本| 久久国产欧美日韩精品| 欧美久久一区| 亚洲国产精品视频| 国产日韩一级二级三级| 一本色道久久综合狠狠躁的推荐| 激情综合在线| 午夜精品在线观看| 亚洲影视九九影院在线观看| 欧美精品在线免费播放| 亚洲高清一区二| 亚洲丰满少妇videoshd| 久久久久**毛片大全| 欧美在线电影| 国产精品视频免费在线观看| 亚洲国产一区二区在线| 亚洲人成在线免费观看| 你懂的国产精品永久在线| 久久久欧美精品| 国内精品国产成人| 久久不射2019中文字幕| 午夜精品在线视频| 国产精品久久久久一区| 亚洲一区二区在线| 欧美一级久久久| 国产欧美日韩一区| 久久成人资源| 免费观看在线综合| 亚洲激情第一页| 欧美高清在线一区二区| 亚洲精品免费观看| 亚洲婷婷综合色高清在线| 欧美少妇一区二区| 亚洲永久免费精品| 久久五月天婷婷| 伊人久久男人天堂| 欧美成人免费网站| 99精品欧美一区二区三区综合在线 | 久久在线视频在线| 欧美凹凸一区二区三区视频| 亚洲黄色成人网| 欧美久久久久中文字幕| 亚洲午夜久久久久久尤物| 羞羞答答国产精品www一本| 国产视频一区二区三区在线观看| 久久99伊人| 亚洲激情小视频| 亚洲欧美乱综合| 狠狠色丁香久久婷婷综合_中| 久久综合色影院| 亚洲美女在线一区| 久久成人18免费网站| 亚洲激情在线播放| 国产精品福利久久久| 久久久亚洲一区| 亚洲乱码一区二区| 久久九九久久九九| 夜夜嗨av一区二区三区四区| 国产欧美精品一区二区色综合| 久久久久久亚洲综合影院红桃 | 亚洲国产另类久久久精品极度| 亚洲午夜精品国产| 精品动漫一区二区| 国产精品v日韩精品v欧美精品网站| 欧美在线国产精品| 亚洲精品一二区| 久久久久久久久久久成人| 日韩一级大片| 国模套图日韩精品一区二区| 欧美精品1区| 欧美自拍丝袜亚洲| aa国产精品| 欧美激情二区三区| 欧美一级二级三级蜜桃| 99精品视频一区二区三区| 国产午夜精品在线| 欧美午夜精彩| 欧美激情一区二区三区全黄| 日韩视频免费观看| 亚洲国产精品小视频| 久久偷窥视频| 欧美在线看片a免费观看| 一本久久综合亚洲鲁鲁五月天| 国产欧美午夜| 国产精品国产自产拍高清av王其 | 宅男66日本亚洲欧美视频| 亚洲国产成人高清精品| 国产自产在线视频一区| 国产精品成人一区二区三区夜夜夜| 免费成人美女女| 欧美中文字幕| 亚洲欧美久久| 亚洲小视频在线观看| 99国产精品久久| 欧美激情黄色片| 久久午夜影视| 久久深夜福利免费观看| 久久成人综合网| 欧美一区亚洲二区| 欧美一区二区福利在线| 亚洲欧美成人网| 亚洲永久在线| 亚洲欧美精品在线观看| 香蕉久久国产| 校园激情久久| 久久国产精品久久久| 午夜亚洲福利| 久久精品视频va| 久久久中精品2020中文| 美女黄毛**国产精品啪啪 | 久久国产综合精品| 久久综合中文字幕| 免费看精品久久片| 亚洲国产裸拍裸体视频在线观看乱了中文 | 欧美一区二区视频在线观看2020| 一本一道久久综合狠狠老精东影业 | 亚洲欧美中文另类| 亚洲网站在线看| 99国产一区二区三精品乱码| 亚洲国产精品久久久久婷婷老年 | 欧美波霸影院| 免费av成人在线| 久久亚洲春色中文字幕久久久| 亚洲欧美国产77777| 99亚洲精品| 在线亚洲伦理| 亚洲精品小视频| 在线看欧美视频| 国产麻豆视频精品| 国产精品青草久久久久福利99| 欧美日韩1080p| 午夜精品久久久久| 欧美一级久久久| 午夜精品久久一牛影视| 一区二区三区精密机械公司| 亚洲一区二区三区高清| av成人国产| 亚洲自拍偷拍一区| 免费成人av| 欧美日韩亚洲高清| 国产精品婷婷| 激情久久影院| 在线观看欧美视频| 亚洲欧美资源在线| 久久久综合网站| 亚洲国产成人91精品| 一区二区激情视频| 欧美在线网站| 欧美金8天国| 国模一区二区三区| 亚洲美女诱惑| 欧美一区二区视频网站| 欧美18av| 免费人成网站在线观看欧美高清| 99在线热播精品免费99热| 性亚洲最疯狂xxxx高清| 欧美激情视频一区二区三区在线播放 | 国产乱码精品1区2区3区| 亚洲大片免费看| 亚洲一区美女视频在线观看免费| 久久高清免费观看| 欧美大片免费观看| 亚洲视频在线一区| 久久嫩草精品久久久久| 欧美色播在线播放| 1024精品一区二区三区| 久久激情综合网| 亚洲九九爱视频| 久久久水蜜桃av免费网站| 欧美午夜剧场| 国产一区视频观看| 欧美一区二区三区免费观看| 亚洲国产精品久久久久秋霞影院| 亚洲综合欧美| 欧美体内she精视频| 黑人巨大精品欧美一区二区| 欧美在线视频免费播放| 日韩一区二区久久| 久久亚洲视频| 国产欧美一区二区精品婷婷| 亚洲毛片在线观看.| 亚洲第一伊人| 久久久国产精品一区二区中文| 国产精品草莓在线免费观看| 亚洲毛片av| 亚洲欧洲午夜| 久久先锋影音| 国产精品一卡二| 这里只有精品视频| 欧美承认网站| 蜜臀久久久99精品久久久久久| 国产欧美日韩一区二区三区| 日韩系列欧美系列| 老司机午夜精品视频在线观看| 亚洲欧美卡通另类91av| 久久综合影音|