Source Code: Write A Program To Add, Subtract and Multiply Two Complex Numbers Using Structures To Function
Source Code: Write A Program To Add, Subtract and Multiply Two Complex Numbers Using Structures To Function
Write a program to add, subtract and multiply two complex numbers using structures to
function.
Source code
#include<iostream>
#include<math.h>
using namespace std;
struct complex
{
int real;
int img;
int main()
{
complex obj,obj1,obj2;
cout << "Enter First Number" << endl;
cout << "real Part" << endl;
cin >> obj1.real;
cout << "Imaginary part" << endl;
cin >> obj1.img;
cout << "Enter Second Number" << endl;
cout << "real Part" << endl;
cin >> obj2.real;
cout << "Imaginary part" << endl;
cin >> obj2.img;
obj.add(obj1,obj2);
obj.subtract(obj1, obj2);
obj.multiply(obj1, obj2);
system("pause");
return 0;
}