09-07-2013, 04:22 PM
COMPLEX NUMBERS OPERATOR OVERLOADING
AIM:
Design a Class Complex with data members for real and imaginary part. Provide default and parameterized constructors. Write a program to perform arithmetic operations of two complex numbers using operator overloading (using either member functions or friend functions
Strictly use Operator Overloading.
OBJECTIVE:
Understand decomposition of a problem into a number of entities called object and then build data and function around these objects.
THEORY:
With C++ feature to overload operators, we can design classes able to perform operations using standard operators. Here is a list of all the operators that can be overloaded:
PRACTICE ASSIGNMENTS:
1. Design a Class Complex with data members for real and imaginary part. Provide default and parameterized constructors. Write a program to perform arithmetic operations of two complex numbers using operator overloading. Overload << to accept two complex numbers
2. Design a Class Complex with data members for real and imaginary part. Provide default and parameterized constructors. Write a program to perform arithmetic operations of two complex numbers using operator overloading. Overload >> to display output of the above performed operations on complex numbers
3. Write a class to represent the vector (a series of float value). Include member function to create a vector and to modify. Overload operator * to multiply by a scalar value. Overload << to display scalar value.