Objectives:
Get yourself familiar with the file processing. Why? Because in real life, data are stored in files.
Use high level file IO as much as possible. Well, that's the essence of overloading << and >>
Importing is usually the hardest part of a database-like application because it needs to "convert" outside format to your internal design format.
If you're up to it, try to design two layers of classes: one for the object (complex) and the other for the collection of objects (complexDB)
Lab 2: File Import/Export and Object Array
Overview
Redo the complex homework and perform add / delete / list / save functions.
Read in a file of complex numbers (sample is attached 126import.txt) and store them in an array of complex objects. (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 value. The value of a complex number a+bi is sqrt(a*a+b*b).
Save function stores the results to file 126complex.txt.
Note
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.
Bonus Points:
Use the challenge input file 126importHard.txt to test for additional corner cases. Write your output to 126exportHard.txt in the same program.
Lab 2b sorted object array
Objectives:.
Repeat Lab 2 with two layers of classes: one for the object (complex) and the other for the collection of objects (complexDB)
Overload less than operator< in complex class based on its value. The value of a complex number a+bi is sqrt(a*a+b*b).
Complex number is sorted in complexDB in ascending order such that complexDB can easily print in ascending order.