当前位置: 首页>>代码示例>>C++>>正文


C++ Complex::getImaginaryPart方法代码示例

本文整理汇总了C++中Complex::getImaginaryPart方法的典型用法代码示例。如果您正苦于以下问题:C++ Complex::getImaginaryPart方法的具体用法?C++ Complex::getImaginaryPart怎么用?C++ Complex::getImaginaryPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Complex的用法示例。


在下文中一共展示了Complex::getImaginaryPart方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Complex

Complex Complex::operator/( const Complex c1 ) {
	double a , b ;
	if ( fabs( c1.getRealPart() ) >= fabs( c1.getImaginaryPart() ) ) {
		a = c1.getImaginaryPart() / c1.getRealPart() ;
		b = 1.0l / ( c1.getRealPart() + a * c1.getImaginaryPart() ) ;
		return Complex( ( R + a * I ) * b , ( I - a * R ) * b ) ;
	} else {
		a = c1.getRealPart() / c1.getImaginaryPart() ;
		b = 1.0l / ( c1.getRealPart() * a + c1.getImaginaryPart() ) ;
		return Complex( ( R * a + I ) * b , ( I * a - R ) * b ) ;
	}
}
开发者ID:elfigo89,项目名称:randomcode,代码行数:12,代码来源:Complex.cpp

示例2: pow

double Complex::pow( Complex base , double exp ) {
	return ( pow( base.getRealPart() , exp ) - pow( base.getImaginaryPart() , exp ) );
}
开发者ID:elfigo89,项目名称:randomcode,代码行数:3,代码来源:Complex.cpp

示例3: Compare

bool Complex::Compare( const Complex & c1 ) {
    if ( R == c1.getRealPart() || I == c1.getImaginaryPart() )
        return true ;
    else
        return false ;
}
开发者ID:elfigo89,项目名称:randomcode,代码行数:6,代码来源:Complex.cpp

示例4:

bool Complex::operator!=( const Complex & c1 ) {
    if ( R != c1.getRealPart() || I != c1.getImaginaryPart() )
        return true ;
    else
        return false ;
}
开发者ID:elfigo89,项目名称:randomcode,代码行数:6,代码来源:Complex.cpp

示例5: subtract

//subtraction function
Complex Complex::subtract(Complex& c){
    //follows imaginary number equation

    return Complex(getRealPart()-c.getRealPart(),getImaginaryPart()-c.getImaginaryPart());

}
开发者ID:StevenAnderson,项目名称:EX06_05,代码行数:7,代码来源:Complex.cpp

示例6:

//sets original to specified
void Complex::operator=(Complex c){
    this->a=c.getRealPart();
    this->b=c.getImaginaryPart();

}
开发者ID:StevenAnderson,项目名称:EX06_05,代码行数:6,代码来源:Complex.cpp

示例7: add

//adding function
Complex Complex::add(Complex& c){
    //follows imaginary number equation
    return Complex(getRealPart()+c.getRealPart(),getImaginaryPart()+c.getImaginaryPart());
}
开发者ID:StevenAnderson,项目名称:EX06_05,代码行数:5,代码来源:Complex.cpp

示例8: divide

//division function
Complex Complex::divide(Complex& c){
    return Complex((getRealPart()*c.getRealPart()+getImaginaryPart()*c.getImaginaryPart())/(c.getRealPart()*c.getRealPart()+c.getImaginaryPart()*c.getImaginaryPart() ),( getImaginaryPart()*c.getRealPart()-getRealPart()*c.getImaginaryPart())/(c.getRealPart()*c.getRealPart()+c.getImaginaryPart()*c.getImaginaryPart() ));
}
开发者ID:StevenAnderson,项目名称:EX06_05,代码行数:4,代码来源:Complex.cpp

示例9: multiply

//multiplication function
Complex Complex::multiply(Complex& c){
    return Complex((getRealPart()*c.getRealPart()-getImaginaryPart()*c.getImaginaryPart()),( getImaginaryPart()*c.getRealPart()+getRealPart()*c.getImaginaryPart()));

}
开发者ID:StevenAnderson,项目名称:EX06_05,代码行数:5,代码来源:Complex.cpp


注:本文中的Complex::getImaginaryPart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。