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

The Fourth Dimension Space

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

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

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

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

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            夜夜嗨网站十八久久| 午夜国产不卡在线观看视频| 99视频日韩| 亚洲另类在线视频| 国产精品久久二区| 久久av资源网| 久热精品视频在线观看| 一本久道久久综合狠狠爱| 夜夜嗨av一区二区三区网站四季av| 欧美日韩少妇| 久久精品国产精品亚洲综合| 久久久综合网站| 正在播放亚洲一区| 欧美在线观看视频在线 | 亚洲精选视频免费看| 欧美日韩性视频在线| 欧美性视频网站| 日韩香蕉视频| 国产精品一区二区视频| 久久国产精品99国产精| 久久午夜视频| 亚洲欧美日韩国产中文| 久久激情五月丁香伊人| 一区二区三区 在线观看视频| 亚洲自拍都市欧美小说| 亚洲激情亚洲| 欧美在线高清视频| 亚洲亚洲精品在线观看| 久久亚洲精品欧美| 欧美亚洲综合久久| 欧美片在线观看| 美日韩精品视频免费看| 国产精品电影观看| 欧美黄色aa电影| 黑人巨大精品欧美一区二区小视频| 久久精品中文字幕一区| 亚洲国产欧美不卡在线观看| 亚洲一区免费看| 久久免费少妇高潮久久精品99| 亚洲精品少妇网址| 久久精品中文| 欧美在线视频导航| 欧美日韩一区二区在线视频| 欧美高清免费| 国内精品视频一区| 亚洲一区在线视频| 99riav国产精品| 久久视频免费观看| 久久久久久婷| 国产中文一区| 久久精品国产91精品亚洲| 香蕉久久夜色精品国产| 欧美色道久久88综合亚洲精品| 亚洲高清激情| 亚洲第一黄色| 久久亚洲捆绑美女| 亚洲欧洲日产国产综合网| 亚洲欧美日韩另类| 欧美日韩大陆在线| 欧美激情第1页| 亚洲国产一区二区三区高清| 久久国产99| 久久久噜噜噜久久中文字免| 国产深夜精品| 久久精品1区| 可以看av的网站久久看| 在线精品国产成人综合| 久久综合中文字幕| 亚洲国产成人精品久久久国产成人一区| 国产亚洲精品v| 久久狠狠亚洲综合| 乱中年女人伦av一区二区| 亚洲国产欧美日韩另类综合| 欧美成人第一页| 日韩视频在线一区| 午夜亚洲福利| 激情欧美一区二区| 亚洲黄一区二区三区| 亚洲综合色激情五月| 亚洲小说欧美另类婷婷| 国产精品久久| 久久爱另类一区二区小说| 老司机免费视频一区二区| 亚洲国产精品一区在线观看不卡| 欧美+日本+国产+在线a∨观看| 亚洲人成久久| 久久aⅴ国产欧美74aaa| 在线看欧美日韩| 欧美日韩伊人| 久久精品视频va| 亚洲精品影视在线观看| 久久国产高清| 日韩亚洲在线| 国产亚洲欧美一区在线观看| 免费成人av| 亚洲欧美制服另类日韩| 欧美激情精品久久久久久大尺度 | 中日韩午夜理伦电影免费| 国产农村妇女精品| 欧美成人精品一区二区| 亚洲一区二区三区高清不卡| 免费在线日韩av| 亚洲欧美综合v| 亚洲精品美女在线| 国产亚洲欧美激情| 国产精品成人在线| 欧美不卡一卡二卡免费版| 亚洲欧美日韩在线播放| 91久久午夜| 麻豆精品精华液| 欧美一区二区三区四区在线 | 免费在线看成人av| 国产精品综合久久久| 欧美mv日韩mv国产网站| 亚洲欧美激情四射在线日| 91久久久久久国产精品| 久久久午夜电影| 久久爱www久久做| 亚洲一区二区在线看| 亚洲精选久久| 91久久精品国产91性色tv| 一区在线播放| 国产一区二区三区黄| 国产精品视频网址| 欧美性猛交xxxx乱大交蜜桃| 免费不卡亚洲欧美| 久热综合在线亚洲精品| 欧美中文字幕不卡| 羞羞答答国产精品www一本| 亚洲视频香蕉人妖| 中文在线资源观看网站视频免费不卡| 亚洲激情二区| 亚洲欧洲在线一区| 亚洲黄色在线视频| 亚洲一区二区三区高清 | 最近中文字幕日韩精品| 老牛国产精品一区的观看方式| 欧美自拍偷拍午夜视频| 欧美有码在线视频| 欧美一二区视频| 久久成人精品一区二区三区| 制服丝袜激情欧洲亚洲| 亚洲色在线视频| 亚洲欧美日韩久久精品 | 99精品热视频| 一区二区三区视频观看| 亚洲午夜日本在线观看| 亚洲一区二区三区乱码aⅴ| 亚洲在线视频| 欧美中文在线观看| 久久这里有精品15一区二区三区| 美女999久久久精品视频| 欧美激情精品久久久久久| 最新亚洲一区| 亚洲精品中文字幕女同| 欧美日韩国产小视频在线观看| 久久综合九色99| 中国成人在线视频| 国产嫩草一区二区三区在线观看 | 在线观看一区欧美| 亚洲第一主播视频| 日韩亚洲国产精品| 亚洲欧美日韩综合| 久久久人成影片一区二区三区 | 99精品欧美一区二区蜜桃免费| avtt综合网| 性欧美在线看片a免费观看| 久久在线观看视频| 欧美日韩一区综合| 激情综合网激情| 欧美在线免费看| 国产亚洲精品久久久久久| 欧美电影资源| 久久久久久久久久看片| 欧美高清视频| 国产日产高清欧美一区二区三区| 在线观看日韩欧美| 亚洲永久免费| 欧美二区在线观看| 亚洲中字黄色| 欧美高清在线| 国产一区美女| 亚洲无玛一区| 蜜臀av一级做a爰片久久| 日韩一级二级三级| 久久综合色婷婷| 国产精品久久久91| 亚洲开发第一视频在线播放| 欧美一区二区三区在线| 91久久香蕉国产日韩欧美9色 | 久久久久久久久久久久久女国产乱 | 乱中年女人伦av一区二区| 亚洲韩国青草视频| 亚洲欧美另类久久久精品2019| 狼狼综合久久久久综合网| 国产区精品在线观看| 正在播放亚洲| 亚洲精品久久久久久久久久久久| 久久久久国产精品麻豆ai换脸| 国产精品久久久久永久免费观看|