Description: 1, [] define a copy constructor complex class CComplex
class CComplex {
private:
float real // real part
float imag // imaginary part
public:
CComplex (float x = 0.0, float y = 0.0): real (x), imag (y) {}
CComplex (CComplex & c)
CComplex operator+ (CComplex & c)
CComplex operator-(CComplex & c)
void print () const {cout << real << "+" << imag << "i" << endl
}
void main () {
CComplex c1 (3, 5), c2 (4, 7)
CComplex c3 = c1+ c2
CComplex c4 = c2- c1
c4.print ()
c3.print ()
}
Please improve the copy constructor CComplex of operator overloading+ and- to complete the assigned functions.
2, [inheritance] square is a special case of a rectangle, define a square class (CSquare) and rectangular class (CRectangle), defined as the square class derived class rectangle class.
(1) having a rectangular perimeter calculation, the area of member functions
(2) as a sub-class also has
To Search:
File list (Check if you may need any files):
c++课程设计\C_course_work_1\C_course_work_1
...........\...............\C_course_work_1.cpp
...........\...............\C_course_work_1.dsw
...........\...............\C_course_work_1.ncb
...........\...............\C_course_work_1.opt
...........\...............\C_course_work_1.plg
...........\...............\Debug\C_course_work_1.exe
...........\...............\.....\C_course_work_1.ilk
...........\...............\.....\C_course_work_1.obj
...........\...............\.....\C_course_work_1.pch
...........\...............\.....\C_course_work_1.pdb
...........\...............\.....\Rectangle.obj
...........\...............\.....\Square.obj
...........\...............\.....\vc60.idb
...........\...............\.....\vc60.pdb
...........\...............\Rectangle.cpp
...........\...............\Rectangle.h
...........\...............\Square.cpp
...........\...............\Square.h
...........\..............2\Complex.cpp
...........\...............\Complex.h
...........\...............\C_course_work_2.cpp
...........\...............\C_course_work_2.dsp
...........\...............\C_course_work_2.dsw
...........\...............\C_course_work_2.ncb
...........\...............\C_course_work_2.opt
...........\...............\C_course_work_2.plg
...........\...............\Debug\Complex.obj
...........\...............\.....\C_course_work_2.exe
...........\...............\.....\C_course_work_2.ilk
...........\...............\.....\C_course_work_2.obj
...........\...............\.....\C_course_work_2.pch
...........\...............\.....\C_course_work_2.pdb
...........\...............\.....\vc60.idb
...........\...............\.....\vc60.pdb
...........\..language_project_design\C_course_work_x.txt
...........\..course_work_1\Debug
...........\..............2\Debug
...........\C_course_work_1
...........\C_course_work_2
...........\C_language_project_design
c++课程设计
readme.txt