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

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>
            久久国产精品色婷婷| 一区二区精品在线| 亚洲无毛电影| 日韩视频在线播放| 欧美午夜欧美| 亚洲欧美日韩中文视频| 一本色道**综合亚洲精品蜜桃冫 | 亚洲日本aⅴ片在线观看香蕉| 亚洲在线观看免费视频| 国产伦精品一区二区三区照片91| 久久精品人人爽| 久久尤物视频| 欧美一区二区三区另类| 欧美在线关看| 亚洲人成在线观看一区二区| 日韩亚洲精品在线| 国产欧美一区二区三区国产幕精品| 久久国产精品第一页| 中文欧美日韩| 久久精品国产精品亚洲综合| 久久午夜av| 一区二区三区 在线观看视频| 亚洲综合色丁香婷婷六月图片| 国产一区二区久久久| 亚洲第一区中文99精品| 欧美午夜不卡视频| 米奇777在线欧美播放| 99视频+国产日韩欧美| 亚洲麻豆国产自偷在线| 亚洲欧美日韩国产精品| 最新国产成人在线观看| 亚洲欧美国产一区二区三区| 亚洲三级电影在线观看| 亚洲欧美一区二区精品久久久| 最新亚洲一区| 午夜精品久久久久久久久| 日韩一级大片在线| 久久久蜜桃一区二区人| 国产精品jizz在线观看美国| 老司机精品导航| 国产精品免费网站在线观看| 亚洲国产1区| 一区二区三区在线视频播放| 一区二区三区四区蜜桃| 亚洲伦伦在线| 亚洲欧美在线免费观看| 亚洲国产精品尤物yw在线观看| 亚洲欧美激情四射在线日 | 欧美91福利在线观看| 欧美三区在线视频| 麻豆亚洲精品| 国产精品一区2区| 日韩一级免费| 亚洲靠逼com| 欧美大片91| 亚洲第一黄色| 亚洲国产欧美一区| 久久久久国产一区二区三区| 久久精品成人| 国产亚洲一区二区三区在线观看 | 久久久久久亚洲精品中文字幕| 欧美色欧美亚洲高清在线视频| 日韩视频欧美视频| 欧美黄色免费网站| 亚洲第一区中文99精品| 久久精品国产在热久久| 欧美一区二区在线播放| 国产精品亚洲一区二区三区在线| 亚洲精品视频免费在线观看| 欧美激情性爽国产精品17p| 国产在线麻豆精品观看| 午夜久久美女| 国产精品日韩一区| 亚洲欧美日韩综合| 久久久精品性| 伊人久久久大香线蕉综合直播| 久久国产视频网| 欧美成人精品1314www| 亚洲国产精品国自产拍av秋霞| 蜜桃精品一区二区三区| 亚洲激情欧美| 欧美日韩国产一级| 亚洲淫性视频| 久久视频精品在线| 在线日韩视频| 欧美日韩网址| 午夜精品久久久久久久99热浪潮| 久久在线视频在线| 亚洲免费高清| 国产精品日日摸夜夜添夜夜av| 国产精品国产三级国产专区53| 国产精品99久久久久久久女警 | 久久久国产精品亚洲一区| 你懂的网址国产 欧美| 亚洲日本成人| 国产精品美女久久| 久久久另类综合| 亚洲精品日韩欧美| 久久久久欧美| 一区二区三区回区在观看免费视频 | 99re6这里只有精品视频在线观看| 欧美日韩另类字幕中文| 欧美在线免费观看视频| 亚洲高清一区二区三区| 一区二区三区四区在线| 国产一区免费视频| 欧美日韩国产首页在线观看| 性色av一区二区怡红| 亚洲黄色有码视频| 久久精品午夜| 亚洲香蕉网站| 尤妮丝一区二区裸体视频| 欧美日韩亚洲一区| 国产精品丝袜91| 日韩视频在线观看免费| 美日韩在线观看| 欧美一级精品大片| 一区二区三区国产在线| 亚洲高清自拍| 国产在线观看一区| 欧美亚州在线观看| 欧美高清视频一区| 性欧美激情精品| 正在播放亚洲| 亚洲免费观看| 亚洲高清在线观看| 欧美1区免费| 久久人人九九| 久久国产精品99国产精| 亚洲一区免费视频| 99人久久精品视频最新地址| 亚洲二区三区四区| 国产亚洲亚洲| 国产亚洲美州欧州综合国| 国产精品嫩草影院av蜜臀| 欧美日韩三级电影在线| 欧美日韩播放| 另类图片国产| 久久久久久久一区二区三区| 亚洲一区二区三区三| 这里只有精品视频在线| 亚洲视频久久| 亚洲欧洲日产国产网站| 亚洲国产精品久久久久秋霞不卡 | 一区二区三区在线看| 国模大胆一区二区三区| 国产亚洲欧美一区| 国模叶桐国产精品一区| 国产亚洲精品美女| 黄色影院成人| 亚洲国产精品女人久久久| 亚洲高清视频在线观看| 亚洲激情在线观看| 亚洲精品一区在线观看香蕉| 亚洲美女啪啪| 一本不卡影院| 亚洲欧美一区二区精品久久久| 亚洲欧美色婷婷| 性色av一区二区三区| 欧美一区二区精品| 久久资源在线| 欧美成人四级电影| 亚洲精品日本| 日韩视频不卡中文| 中国成人黄色视屏| 欧美一区二区在线免费播放| 久久精品国产亚洲一区二区| 久久伊人精品天天| 欧美日韩午夜| 狠狠色狠狠色综合日日91app| 18成人免费观看视频| 99国产精品99久久久久久| 亚洲综合色噜噜狠狠| 欧美在线观看视频一区二区| 久久一区二区三区国产精品| 欧美阿v一级看视频| 亚洲精品乱码久久久久久按摩观 | 欧美xart系列高清| 夜夜嗨av一区二区三区网页| 欧美一级片久久久久久久 | 亚洲激情另类| 亚洲欧美在线网| 久久九九全国免费精品观看| 欧美激情1区2区| 国产一区二区主播在线| 亚洲国产日韩一区二区| 亚洲欧美日韩综合国产aⅴ| 你懂的视频欧美| 99www免费人成精品| 久久国产主播| 国产精品久久久久久影院8一贰佰| 狠狠色综合一区二区| 亚洲自拍另类| 亚洲国产精品欧美一二99| 销魂美女一区二区三区视频在线| 欧美裸体一区二区三区| 在线国产亚洲欧美| 欧美中文在线观看| 一本色道久久综合亚洲精品高清 | 99热免费精品|