Question: Escribe este programa en C++: Escribe la clase Complejo que permita operar con nmeros complejos. Dicha clase almacenar el valor real y el imaginario del

Escribe este programa en C++:

Escribe la clase Complejo que permita operar con nmeros complejos. Dicha clase almacenar el valor real y el imaginario del nmero complejo en variables miembro, as como proporcionar operadores sobrecargados para realizar las operaciones ms habituales con dichos nmeros. Ser necesario un constructor con parmetros para poder inicializar los valores de los atributos. Dados los nmeros: z1 = (a, b) y z2 = (c, d), implementa las operaciones:

Escribe este programa en C++: Escribe la clase Complejo que permita operar

Muestra en pantalla las 5 operaciones para dos nmeros complejos de entrada.

Nota1: En la diferencia el operador debe ser -

Nota2: Hay un error en el producto. El segundo elemento debe ser ad+bc

Nota 3: Para la parte del escalar, no se puede usar nuevamente el operador * (seleccionar cualquier otro que no se haya utilizado). En el ejemplo utilic %.

Complejo operator % (float k){ // el segundo elemento es del tipo float mientras el primero es un objeto de la clase Complejo

Complejo total(1,1);

total.real = real*k;

total.img = img*k;

return total;

ENGLISH:

Write this program in C++:

Write the Complex class that allows to operate with complex numbers. This class will store the real and imaginary value of the complex number in member variables, as well as provide overloaded operators to perform the most common operations with said numbers. A constructor with parameters will be necessary to be able to initialize the values of the attributes. Given the numbers: z1 = (a, b) and z2 = (c, d), implement the operations:

con nmeros complejos. Dicha clase almacenar el valor real y el imaginario

Displays the 5 operations for two input complex numbers.

Note1: In the difference the operator must be -

Note2: There is a bug in the product. The second element must be ad+bc

Note 3: For the scalar part, the * operator cannot be used again (select any other that has not been used). In the example I used %.

Complex operator % (float k){ // the second element is of type float while the first is an object of class Complex

Total complex(1,1);

total.real = real*k;

total.img = img*k;

return total;

= . Suma: Z1 + Z2 = (a + c,b+d) Diferencia: Zn + Z2 = (a -c,b-d) Producto: 21 22 = (ac bd , ad bc) : ac + bd -ad + bc 21 22 c +6 c +6 Producto por un escalar: k_z = (ka,kb) = Divisin: 1 - (not be = . Suma: Z1 + Z2 = (a + c,b+d) Diferencia: Zn + Z2 = (a -c,b-d) Producto: 21 22 = (ac bd , ad bc) : ac + bd -ad + bc 21 22 c +6 c +6 Producto por un escalar: k_z = (ka,kb) = Divisin: 1 - (not be = . Suma: Z1 + Z2 = (a + c,b+d) Diferencia: Zn + Z2 = (a -c,b-d) Producto: 21 22 = (ac bd , ad bc) : ac + bd -ad + bc 21 22 c +6 c +6 Producto por un escalar: k_z = (ka,kb) = Divisin: 1 - (not be = . Suma: Z1 + Z2 = (a + c,b+d) Diferencia: Zn + Z2 = (a -c,b-d) Producto: 21 22 = (ac bd , ad bc) : ac + bd -ad + bc 21 22 c +6 c +6 Producto por un escalar: k_z = (ka,kb) = Divisin: 1 - (not be

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!