Question
Read in a file of complex numbers (sample is attached 126import.txt) and store them in an array of complex objects do not use vectors or
Read in a file of complex numbers (sample is attached 126import.txt) and store them in an array of complex objects do not use vectors or other data structures for this lab. (Would you be able to do either static or dynamic array?)
Create a menu to allow console add/delete/list and save functions. (You can also do load functions to make it more complete). The list and save function needs to print out the numbers in ascending order based on its magnitude. The value of a complex number a+bi is sqrt(a*a+b*b).
Save function stores the results to file 126complex.txt.
Note:
If you can not handle a few corner cases, e.g. the last 3 complex number, remove them and focus on the main part. You will not get the full grade, but at least you need to get some code working.
You need to implement operator overloading to compare complex numbers as well as stream insertion/extraction operators.
It is highly recommended that you implement TWO classes (complex and complexDB) for this lab. It will be a good foundation for future data structure practices.
126import.txt includes:
1+1i
2+2i
3.3+3.4i
4.4-4.5i
- 5.5-5.6i
- 6
7i
- 8i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started