Complex Number Calculator – C++
This program helped me to understand basic concepts related to operators overloading. When dealing with classes in Object-oriented Paradigm, it is not possible to apply operators on class objects directly. Operator overloading helps to overload functionality of these operators so that they can be used easily as we use with any other datatype. This program takes 2 Complex numbers input from the user and then computer addition, subtraction, multiplication, and division of these two complex numbers and show the results on screen.
I tested my program with different inputs and it worked fine in all cases. I entered different values for Complex Numbers and results generated were according to the requirements.
Here are some screenshots of the output.
By using operator overloading, it becomes very easy to apply different operators on class objects. Although we can use class member functions that can serve the purpose that will be simple function calling and we cannot get the flavor of true operators usage.