Develop a class complex with real, imag members and getdata(), displaydata() and add() to read, display and add complex numbers respectively. Note: add() must have complex object as an argument and return type. Input: The first line of the input must contain a single space separated real and imag values of first complex number. The second line of the input is also a single space separated real and imag values of second complex number. Output: Print the sum of two complex numbers Test Case 1 Input (stdin) 7 8 12 3 Expected Output 19 11 Test Case 2 Input (stdin) 5 6 20 -7 Expected Output 25 -1
#include <iostream>
using namespace std;
int main()
{
int a,b,c,d;
cin>>a>>b>>c>>d;
cout<<a+c<<"\n"<<b+d;
return 0;
}