📄 client.cpp
字号:
//***************************************************
// Filename: client.cpp
// To test the ComplexNum class
// Programming Problems No.3 on P472 of textbook.
//***************************************************
#include"complexNum.h"
#include<iostream>
using namespace std;
void main()
{
ComplexNum c,c1,c2; // default constructor called
ComplexNum c3(3.0,4.0);// parameter constructor called
//Set
c2.Set(2.5,4.5);
//Print
cout<<"c1, c2 and c3 as follows:" << endl;
c1.Print();
c2.Print();
c3.Print();
// RealPart and ImagPart
cout<<" the real part and imag part of c1, c2 and c3 as follows:" << endl;
cout << "c1 " << c1.RealPart() << " " << c1.ImagPart() << endl;
cout << "c2 " << c2.RealPart() << " " << c2.ImagPart() << endl;
cout << "c3 " << c3.RealPart() << " " << c3.ImagPart() << endl;
// Cabs
cout<<"The absolute value of c1, c2 and c3 as follows:" << endl;
cout << c1.Cabs() << endl
<< c2.Cabs() << endl
<< c3.Cabs() << endl;
//add
cout<<" c2+c3 = ";
c=c2.Cadd(c3);
c.Print();
//minus
cout<<" c2-c3 = ";
c=c2.Csub(c3);
c.Print();
//mutiply
cout<<" c2*c3 = ";
c=c2.Cmult(c3);
c.Print();
//divide
cout<<" c2/c3 = ";
c=c2.Cdiv(c3);
c.Print();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -