Question: PART 1 ( 2 0 points ) : Compare and contrast the dynamic memory allocation and deallocation operators: new, new [ ] , delete, and
PART points:
Compare and contrast the dynamic memory allocation and deallocation operators: new,
new delete, and delete Discuss their purposes, differences, and usage scenarios.
PART points:
Using the set of files that deal with Complex numbers, you will encounter an error. Identify
the error, explain its cause, and describe how you would resolve the issue.
PART points:
Refer to the class COMPLEX from EXAM # Complex Files, which facilitates operations
on complex numbers of the form realPart imaginaryPart i where i is
equal to the value of sqrt
Modify the class to support input and output of complex numbers using the
overloaded and operators, respectively. You should remove the toString
function from the class.
Overload the multiplication operator to allow for the multiplication of two complex
numbers, following algebraic principles.
Overload the and operators to enable comparisons between complex
numbers.
THE FILES WE WILL WORK ON HEADER FILE Complex class definition #ifndef COMPLEXH #define COMPLEXH # include using namespace std; class Complex public: Complexdouble double ; constructor Complex operatorconst Complex& const; addition Complex operatorconst Complex& const; subtraction string toString const; private: double real; real part double imaginary; imginary part ; #endif" IMPLEMENTATION FILE Complex class memberfunction definitions. #include #include "Complex.h using namespace std; Constructor Complex::Complexdouble realPart, double imaginaryPart : realrealPart imaginaryimaginaryPartaddition operator Complex Complex::operatorconst Complex& operand const return Complex real operandreal, imaginary operandimaginary ; subtraction operator Complex Complex::operatorconst Complex& operand const return Complex real operandreal, imaginary operandimaginary ; retrun string representation of a Complex object in the form: a b string Complex::toString const return s tostringreals tostringimaginarys; AND LAST MAIN FILE # include # include "Complex.h using namespace std; int main Complex x; Complex y; Complex z; cout x: xtoString
y: ytoString
z: z; x y z; cout
x y z:
xtoString ytoString ztoString; x y z; cout
x y z:
xtoString ytoString ztoString; i use xcode so rewrite the code according to that only also hints professor gave use for extra credit use all three cases using one void pointer i i and i please answer this asap
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
