本文整理汇总了C++中Complex::Display方法的典型用法代码示例。如果您正苦于以下问题:C++ Complex::Display方法的具体用法?C++ Complex::Display怎么用?C++ Complex::Display使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Complex
的用法示例。
在下文中一共展示了Complex::Display方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetF
void GetF(Complex complex)
{
std::cout<<"f(z)=z^3-3*z^2+4*z-2 and z=("<<complex.real<<", "<<complex.imag<<")"<<std::endl;
//Complex complex(2.0, 3.0);
Complex r;
Complex r1;
Complex r2;
Complex r3;
Complex result;
r=r.cmul(complex, complex);
r1=r1.cmul(r, complex);
// (3, 0)*z*z
Complex r5(3, 0);
r2=r2.cmul(r5, r);
// (4, 0)*z
Complex r6(4, 0);
r3=r3.cmul(r6, complex);
// (2, 0)
result=result.csub(r1, r2);
result=result.cadd(result, r3);
Complex r4(2, 0);
result=result.csub(result, r4);
result.Display();
}
示例2: main
int main()
{
Complex x(1.1f, -2.7f);
Complex y(2.1f, 3.3f);
Complex z;
z = x+y;
cout << "x+y = ";
z.Display();
z = x/y;
cout << "x/y = ";
z.Display();
z = y/x;
cout << "y/x = ";
z.Display();
return 0;
}
开发者ID:inf-eth,项目名称:i02-0491-courses,代码行数:20,代码来源:PII-Sum2013-16-Copy_Constructor_and_Assignment_Operator-27-06-2013.cpp
示例3: main
int main()
{
Complex x(1.1f, -2.7f);
Complex y(2.1f, 3.3f);
Complex z;
z = x+y;
cout << "x+y = ";
z.Display();
cout << endl;
z = x/y;
cout << "x/y = ";
z.Display();
cout << endl;
z = y/x;
cout << "y/x = ";
z.Display();
cout << endl;
// Matrix operations.
Matrix m1(3);
Matrix m2(3);
Matrix m3(3);
cout << "Enter matrices: " << endl;
m1.Input();
m2.Input();
m3 = m1 + m2;
cout << "Result of addition is: ";
m3.Display();
return 0;
}