1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
rusak2 [61]
3 years ago
5

Write a function namedadd_complex that adds the correspondingnumbers of its arguments (both complexstructures), then returns the

result (anothercomplex structure)
Computers and Technology
1 answer:
amid [387]3 years ago
3 0

Answer:

#include <iostream>

using namespace std;

struct complex{//structure of comlex number..

double real;

double img;

};

complex add_complex(complex n1,complex n2)//add_complex functrion to add 2 complex numbers..

{

   double a,b;//variables to hold the sum of real and imaginary.

   complex sum;//result sum complex number.

   a=n1.real+n2.real;//adding real parts.

   b=n1.img+n2.img;//adding imaginary parts..

   sum.real=a;//assinging values to sum.

   sum.img=b;

   return sum;//returning complex number sum.

}

int main()

{

 complex c1,c2,sum;

 double a,b;

 cout<<"Enter values of c1"<<endl;

 cin>>a>>b;

 c1.real=a;

 c1.img=b;

 cout<<"Enter values of c2"<<endl;

 cin>>a>>b;

 c2.real=a;

 c2.img=b;

 sum=add_complex(c1,c2);

 cout<<"The sum is : "<<sum.real<<" + i"<<sum.img<<endl;

 return 0;

}

OUTPUT:-

Enter values of c1

8.5 7.2

Enter values of c2

4.5 3.9

The sum is : 13 + i11.1

Explanation:

First I have created a structure for complex number.Then created a function to add two complex numbers according to the question which returns a complex number.

You might be interested in
What are the two main components on the motherboard?
Advocard [28]
<span>A chipset which forms an interface between the CPU's front-side bus, main memory, and peripheral buses. Non-volatile memory chips (usually Flash ROM in modern motherboards) containing the system's firmware or BIOS. A clock generator which produces the system clock signal to synchronize the various components.</span>
6 0
3 years ago
Read 2 more answers
Using e-mail has decreased the number of hand-written letters that people send to their friends and relatives. this is a ____ fu
k0ka [10]
Hello <span>Alexkalhor5415

</span>Answer: Using e-mail has made it easy, fast, and inexpensive for family members who live in different parts of the united states to keep in touch. this is a positive  function of e-mail.
Hope this helps-Chris
6 0
3 years ago
Can i have help for a ggogle class room
andrew11 [14]

Answer:

or tell ur teacher to add u in ur class

Explanation:

3 0
3 years ago
Read 2 more answers
3.5 Code Practice: Question 1<br> (Website: Edhesive)
igor_vitrenko [27]
Sorry the website wasn’t working for me
3 0
3 years ago
Does anyone know edhesive 4.3 question 1
navik [9.2K]

No

.................................. :)

5 0
3 years ago
Read 2 more answers
Other questions:
  • What natural resources fueled industrialization in the united states?
    14·1 answer
  • PLEASE HELPPPPPPP
    15·1 answer
  • What is the value of i printed? j = i = 1 i += j + j * 5 print("What is i?", i)
    11·1 answer
  • What is the role of the W3C? Group of answer choices oversee research and set standards for many areas of the Internet supervise
    10·1 answer
  • Teniendo en cuenta la realidad mundial acerca de la pandemia, ¿cómo crees que impacta
    9·1 answer
  • Select the correct word to complete the sentence.
    8·1 answer
  • Using the Impress program, you can add multimedia files, including audio, image, and video files, to the presentation
    13·2 answers
  • Which is the first computer brought in nepal for the census of 2028 B.S​
    6·1 answer
  • In Super Mario Bros., you become Mario and your friend is Mario’s younger brother Luigi. Your job is to race through Mushroom Ki
    10·1 answer
  • Help me please. I dont really understand this.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!