Question: Write this code in c++ Create a class complex: In our implementation each complex has an imaginary part and a real part that are integers
Write this code in c++
Create a class complex: In our implementation each complex has an imaginary part and a real part that are integers in range [1 10].
Our goal is to have a bag of complex numbers with size 100.
The problem is: To search for a specific complex number we have to match both real and imaginary parts that is more time consuming than a simple integer, especially when the range of imaginary and real numbers is only 10 numbers. The problem gets worst if the type of object that you are storing in the bag is more difficult to compare.
Suggest a strategy to overcome this problem by linear increase in the memory. Implement your strategy for the complex number.
You should have complex.h, complex.cpp, bag.h, bag.cpp and main.cpp files.
Full documentation and precondition and post condition is needed.
Code should be clean and the name of the identifiers should be appropriate to their actual meaning.
main.cpp contains the test of your work. I expect you insert at least 50 numbers into your bag.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
