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

The Fourth Dimension Space

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

復(fù)數(shù)類(lèi)模板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 閱讀(254) 評(píng)論(0)  編輯 收藏 引用


只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   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>
            欧美一区二区三区喷汁尤物| 欧美一级视频一区二区| 免费观看在线综合| 亚洲福利电影| 欧美成人精品在线| 欧美v日韩v国产v| 洋洋av久久久久久久一区| 亚洲电影专区| 欧美另类videos死尸| 亚洲视频在线观看| 在线综合亚洲| 国产视频欧美视频| 久久久噜噜噜久久久| 久久久精品久久久久| 亚洲日本理论电影| 在线视频一区观看| 国产一区二区按摩在线观看| 欧美a级片网站| 欧美视频在线观看免费| 久久成人免费| 欧美aaa级| 亚洲欧美久久久| 久久久精品一区二区三区| 亚洲精品美女久久久久| 亚洲综合社区| 亚洲激情女人| 亚洲一区不卡| 亚洲国产一区二区三区a毛片| 亚洲人成亚洲人成在线观看| 国产精品午夜久久| 欧美成人国产一区二区| 国产精品xxxxx| 免费欧美高清视频| 国产精品久久久久久av下载红粉| 久久久亚洲精品一区二区三区| 欧美国产在线电影| 久久精品一区四区| 欧美视频官网| 欧美电影免费观看大全| 国产欧美精品日韩| 亚洲人成毛片在线播放| 精品91在线| 亚洲欧美在线x视频| 一区二区久久久久| 久热这里只精品99re8久| 性欧美大战久久久久久久久| 欧美成人自拍| 欧美成人国产va精品日本一级| 国产精品自在线| 日韩一二三区视频| 91久久久精品| 久久久久久久一区| 亚洲欧美日韩中文播放| 欧美美女视频| 欧美激情在线狂野欧美精品| 国产精品网站一区| 一区二区三区精品| 中文精品一区二区三区| 欧美激情一区二区三区在线视频观看| 久久精品视频免费播放| 国产精品一区免费在线观看| 99精品视频免费观看| 亚洲剧情一区二区| 欧美成人精品在线| 欧美激情区在线播放| 在线观看日韩一区| 久久久噜噜噜久久中文字免| 久久久综合激的五月天| 国产午夜精品理论片a级大结局| 国产精品99久久久久久www| 一区二区三区免费在线观看| 欧美另类一区二区三区| 亚洲人成在线播放网站岛国| 亚洲国产精品电影| 欧美成人精品激情在线观看| 亚洲国产精品一区二区第四页av| 亚洲第一精品久久忘忧草社区| 欧美中文在线免费| 久热精品视频在线| 亚洲黄色一区二区三区| 欧美成人精品一区| 日韩亚洲欧美高清| 久久久99爱| 欧美福利一区| 中文欧美日韩| 国产一区二区三区四区三区四| 欧美一区二区播放| 欧美国产日韩一区二区| 日韩午夜av在线| 欧美三级电影大全| 校园春色国产精品| 美日韩在线观看| 亚洲激情精品| 国产精品久久久久9999| 久久精品亚洲国产奇米99| 欧美大片免费观看| 亚洲午夜一区二区| 国产精品欧美日韩| 久久久999精品| 99精品欧美一区二区三区| 欧美在线亚洲| 亚洲欧洲在线免费| 国产麻豆日韩欧美久久| 久久综合久久88| 亚洲精品美女91| 久久久久九九视频| 99re6这里只有精品视频在线观看 99re6这里只有精品 | 欧美日韩亚洲另类| 亚洲一区美女视频在线观看免费| 久久天天躁狠狠躁夜夜爽蜜月| 亚洲精品国久久99热| 国产精品久久网| 久久三级视频| 亚洲一二三区精品| 亚洲国产精品久久久久秋霞蜜臀 | 久久大逼视频| 9i看片成人免费高清| 国外成人网址| 国产精品分类| 欧美伦理一区二区| 免费精品视频| 久久爱www久久做| 在线亚洲成人| 亚洲韩国一区二区三区| 久久一区二区视频| 亚洲性色视频| 日韩一二三区视频| 亚洲国产99精品国自产| 国产麻豆91精品| 国产精品v欧美精品v日本精品动漫| 久久久五月婷婷| 亚洲欧美日韩综合国产aⅴ| 亚洲毛片在线| 亚洲日本欧美日韩高观看| 欧美成在线观看| 久久人人爽国产| 欧美影视一区| 性高湖久久久久久久久| 亚洲色图在线视频| 一区二区三区高清在线 | 欧美日韩免费一区二区三区视频| 卡通动漫国产精品| 久久色在线观看| 久久国产99| 欧美一级在线视频| 性欧美18~19sex高清播放| 亚洲天堂av在线免费观看| 亚洲另类自拍| 亚洲欧洲一级| 亚洲精品视频在线观看网站| 91久久精品国产91久久性色| 亚洲狠狠婷婷| 91久久国产综合久久91精品网站| 最新日韩av| 夜夜嗨av一区二区三区四季av| 日韩亚洲一区二区| 亚洲无限乱码一二三四麻| 亚洲综合三区| 久久精品视频一| 美女主播视频一区| 欧美片网站免费| 欧美亚一区二区| 国产欧美日韩精品在线| 黄色精品一区| 亚洲日本欧美| 亚洲一区在线观看视频| 久久成人精品| 欧美成人国产一区二区| 亚洲美女黄色片| 午夜精品福利电影| 久久精品日韩欧美| 欧美黄污视频| 国产精品va在线播放| 国产一区二区三区不卡在线观看 | 国产精品久在线观看| 国产一区二区主播在线| 亚洲国产视频一区| 亚洲欧美激情四射在线日| 久久亚洲国产精品一区二区| 亚洲国产日韩欧美一区二区三区| 亚洲免费av观看| 欧美一区深夜视频| 欧美日韩1区2区| 国内精品免费在线观看| 99天天综合性| 久久久久综合网| 亚洲精品综合在线| 久久成人综合视频| 欧美激情第9页| 国产一区二区久久精品| 一区二区福利| 免费毛片一区二区三区久久久| 亚洲毛片网站| 久久夜色精品国产噜噜av| 国产精品久久久亚洲一区| 亚洲精品在线二区| 久久综合免费视频影院| 99热在这里有精品免费| 开心色5月久久精品| 国产一区二区三区精品久久久|