In this tutorial, we will write a C++ program to perform a multiplication on two complex numbers. Before that, you may go through the following topic in java.

**C++ Program to Multiply two Complex Numbers using Struct**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <stdio.h> //structure typedef struct COMPLEX { int a; int b; } Complex; //user-defined function to calculate Complex multiplicationFunc(Complex x, Complex y) { Complex z; z.a = x.a *y.a - x.b *y.b; z.b = x.a *y.b + x.b *y.a; return z; } //Main function int main() { int a1, b1, a2, b2; Complex x, y, z; printf("Enter first complex number (a+bi) : "); scanf("%d+%di", &a1, &b1); printf("Enter second complex number (a+bi) : "); scanf("%d+%di", &a2, &b2); x.a = a1; x.b = b1; y.a = a2; y.b = b2; //calling multiplication function z = multiplicationFunc(x, y); //Printing the result printf("\nFinal multiplication result: %d+%di", z.a, z.b); return 0; } |

**Output:**

`Enter first complex number (a+bi) : 2+3i`

Enter second complex number (a+bi) : 2+3i

Final multiplication result: -5+12i