answersLogoWhite

0


Best Answer

#include<iostream>#include<complex>

int main () {

using namespace std;

complex a {1, 1};

complex b {42, 2};

cout a << " + " << b << " = " << a + b << endl;

cout a << " - " << b << " = " << a - b << endl;

}

User Avatar

Wiki User

7y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

I could, but it is your homework, innit?

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do write a program in c plus plus for addition and subtraction of two complex numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is matrix programming in C programming?

C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion


Addition of two numbers on plsql program?

--THE SUM OF TWO NUMBERS: declare a number(2); b number(2); c number(2); begin a:=&amp;a; b:=&amp;b; c:=a+b; dbms_output.put_line(a ' + 'b' = 'c); end;


An instruction book or program that takes users through a prescribed series of steps to learn a complex program is called a?

An instruction book or program that takes users through a prescribed series of steps to learn a complex program is called a tutorial.


Write a program to add two numbers using oop?

#include&lt;iostream.h&gt; #include&lt;conio.h&gt; void main() { int a, b, c; clrscr(); cout&lt;&lt;"enter the two numbers"; cin&gt;&gt;a; cin&gt;b; c=a+b; cout&lt;&lt;"Addition of two numbers="&lt;&lt;c; getch(); }


C program to multiply two complex no?

/*C++ program to multiply two complex numbers using * operator overloading*/ #include&lt;iostream.h&gt; #include&lt;conio.h&gt; class complex { float x,y; public: complex() {} complex(float real,float img) { x=real; y=img; } complex operator*(complex); void display() { cout&lt;&lt;x&lt;&lt;" + "&lt;&lt;y&lt;&lt;"i"&lt;&lt;endl; } }; complex complex::operator*(complex e) { complex temp; temp.x=x*e.x+y*e.y*(-1); temp.y=x*e.y+y*e.x; return(temp); } void main() { clrscr(); complex c1(5,3),c2(3,2),c3=c1*c2; c1.display(); c2.display(); cout&lt;&lt;"Multiplication"&lt;&lt;endl; c3.display(); getch(); } OUTPUT: 5 + 3i 3 + 2i Multiplication 9 + 19i

Related questions

What are the primary arithmetic operations a computer program can perform?

The four primary arithmetic operations a computer program can perform are addition, subtraction, multiplication and division.2 + 3 = 5 is an example of addition9 - 7 = 7 is an example of subtraction2 x 3 = 6 is an example of multiplication10 / 2 = 5 is an example of division


What is an arithmetic operator in c program?

An arithmetic operator is any of the "atomic" operators to do the following math operations: + addition - subtraction / division * multiplication % modulus division


What is matrix programming in C programming?

C Examples on Matrix OperationsA matrix is a rectangular array of numbers or symbols arranged in rows and columns. The following section contains a list of C programs which perform the operations of Addition, Subtraction and Multiplication on the 2 matrices. The section also deals with evaluating the transpose of a given matrix. The transpose of a matrix is the interchange of rows and columns.The section also has programs on finding the trace of 2 matrices, calculating the sum and difference of two matrices. It also has a C program which is used to perform multiplication of a matrix using recursion.C Program to Calculate the Addition or Subtraction & Trace of 2 MatricesC Program to Find the Transpose of a given MatrixC Program to Compute the Product of Two MatricesC Program to Calculate the Sum & Difference of the MatricesC Program to Perform Matrix Multiplication using Recursion


What is the name of the computer program used in kindergarten and elementary school to learn Math and English where the characters were aliens?

The program is called Number Munchers and teaches addition, subtraction, multiplication, division, basic number theory, factoring and other arithmetic topics.


What program to add two Complex numbers in java?

I found this class that defines complex numbers, and has the capacity of adding them, and much more: http://www.math.ksu.edu/~bennett/jomacg/c.html Basically, you define a class with two fields, one for the real part, and one for the imaginary part.


Write a c program that multiplies two numbers by repeated subtraction?

int mul (int a, int b) { int sum= 0; for (; b&gt;0; --b) sum -= -a; for (; b&lt;0; ++b) sum -= a; return sum; }


How do you develop a JAVA program that computes matrices?

Matrices can't be "computed" as such; only operations like multiplication, transpose, addition, subtraction, etc., can be done. What can be computed are determinants. If you want to write a program that does operations such as these on matrices, I suggest using a two-dimensional array to store the values in the matrices, and use for-loops to iterate through the values.


Addition of two numbers on plsql program?

--THE SUM OF TWO NUMBERS: declare a number(2); b number(2); c number(2); begin a:=&amp;a; b:=&amp;b; c:=a+b; dbms_output.put_line(a ' + 'b' = 'c); end;


An instruction book or program that takes users through a prescribed series of steps to learn a complex program is called a?

An instruction book or program that takes users through a prescribed series of steps to learn a complex program is called a tutorial.


Write a program to add two numbers using oop?

#include&lt;iostream.h&gt; #include&lt;conio.h&gt; void main() { int a, b, c; clrscr(); cout&lt;&lt;"enter the two numbers"; cin&gt;&gt;a; cin&gt;b; c=a+b; cout&lt;&lt;"Addition of two numbers="&lt;&lt;c; getch(); }


Write a program for addition of two numbers in C language?

int main (void) { printf ("%d+%d=%d\n", 6, 7, 6+7); return 0; }


C program to multiply two complex no?

/*C++ program to multiply two complex numbers using * operator overloading*/ #include&lt;iostream.h&gt; #include&lt;conio.h&gt; class complex { float x,y; public: complex() {} complex(float real,float img) { x=real; y=img; } complex operator*(complex); void display() { cout&lt;&lt;x&lt;&lt;" + "&lt;&lt;y&lt;&lt;"i"&lt;&lt;endl; } }; complex complex::operator*(complex e) { complex temp; temp.x=x*e.x+y*e.y*(-1); temp.y=x*e.y+y*e.x; return(temp); } void main() { clrscr(); complex c1(5,3),c2(3,2),c3=c1*c2; c1.display(); c2.display(); cout&lt;&lt;"Multiplication"&lt;&lt;endl; c3.display(); getch(); } OUTPUT: 5 + 3i 3 + 2i Multiplication 9 + 19i