Adding and two objects

Description:

using binary operator overloading program in c++ , create a class and 3 object. Give two set of input for object 1 and two set of input in object2. sample: object1(x1,y1), here the values are given in float values. Test Case 1 Input (stdin) 1.2 1.2 1.4 1.4 Expected Output obj1=1.2+j1.2 obj2=1.4+j1.4 obj3=2.6+j2.6 Test Case 2 Input (stdin) 2.1 2.3 1.4 1.4 Expected Output obj1=2.1+j2.3 obj2=1.4+j1.4 obj3=3.5+j3.7

Program :


#include <iostream>

using namespace std;

int main()

{

float a1,a2,b1,b2,c1,c2;

cin>>a1>>a2>>b1>>b2;

  c1=a1+b1;

  c2=a2+b2;

  cout<<"obj1="<<a1<<"+j"<<a2<<endl;

  cout<<"obj2="<<b1<<"+j"<<b2<<endl;

  cout<<"obj3="<<c1<<"+j"<<c2;

return 0;

}