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
postnew [5]
2 years ago
12

Write a function namedmake_complex that stores its twoarguments (both of type double) in acomplex structure, then returns thestr

ucture.
Computers and Technology
1 answer:
valentina_108 [34]2 years ago
3 0

Answer:

#include <iostream>

using namespace std;

struct complex{//structure of comlex number..

double real;

double img;

};

complex make_complex(double a,double b)//function to return complex number with two arguments of type double..

{

   complex n1;

   n1.real=a;

   n1.img=b;

   return n1;//returning complex number..

}

int main() {

   complex n;

   double a,b;

   cout<<"Enter real and Imaginary respectively"<<endl;

   cin>>a>>b;//taking input of real and imaginary parts..

   n=make_complex(a,b);//calling function..

   cout<<"Comlex number is : "<<n.real<<" + i"<<n.img;//printing the output..

return 0;

}

output:-

Enter real and Imaginary respectively

5.4 8.9

Comlex number is : 5.4 + i8.9

Explanation:

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

You might be interested in
Can you hook up an ethernet cable to a phone jack
laila [671]
The connector for ethernet cables is called RJ45. for phone jack is RJ11. Although they look the same, the RJ11 has only 4 leads, as opposed to 9 leads in RJ45. Also, RJ11 is not as wide as RJ45, so the connector does not fit.

Even if it would, the signals would be totally incompatible, so no success can be expected.
8 0
3 years ago
13,Which hardware device is used in decoding the machine language version of an instruction in the Instruction Decode stage of t
Julli [10]
It should be the control unit
8 0
1 year ago
Which of the following tasks would least help an individual achieve a goal to safely lose weight?
ozzi
To continue to look at motivational or inspirational quotes to remind them or to remember how far you have come and it is not time to give up!
7 0
2 years ago
Read 2 more answers
Why might a variable used for output have to be of a different type then a variable used for input?​
telo118 [61]

Answer:

You may use a different variable type for input in order to process the data appropriately and may use a different variable type to accommodate your program.

Explanation:

Your input may have to be different then output varying on what data you are processing.

For example, just like the last question you asked about calculating the area of the rectangle, your input MUST be converted to a different a numerical data type (i.e int or float) in order to do the math.

Based on your last question, if we didn't convert your input into a string your results wouldn't add the numbers together but only concatenate them. If I typed 3 & 5 as length & width, I would get 35 instead of 15.

Now another example is using functions (or methods whatever you want to call them), your input can be one thing and outputs another.

Let's say I want a function to tell me if I am smart. The way I want it to determine if its smart is by inputting my GPA into it, which is a numerical value. So the function would look something like this:

<u>Code (Python)</u>

def IsSmart(gpa):

  if (gpa >= 4):

       return True

  else

       return False

As you can see I am inputting a numerical value and it is outputting a boolean value. I can use this in a if else chain to spit out an output to the user.

7 0
3 years ago
When companies want people to think their brand is wholesome, trustworthy, and confident, this is the color most often chosen.
notsponge [240]
A. Blue. When you want to be viewed as trustworthy and cool you would use the color blue.
6 0
3 years ago
Read 2 more answers
Other questions:
  • The columns of a spreadsheet data source are A. form letters. B. the mailing list. C. data points. D. fields.
    12·1 answer
  • What feature of the new internet browser, microsoft edge, allows you to write or draw on a web page, highlight items, erase your
    5·1 answer
  • What's the problem with this code ?
    14·1 answer
  • What does social protocol means in network?
    9·1 answer
  • Write the definition of a function named averager that receives a double parameter and returns-- as a double -- the average valu
    11·1 answer
  • Im bored anyone up for a convo? lets talk.. =D
    7·2 answers
  • is a private connection of LANs and WANs that belongs to an organization, and is designed to be accessible only by the members a
    14·1 answer
  • POINT AND BRAINLIEIST GIVE AWAY!!!
    11·2 answers
  • What is a Forloop and what is it used for?
    7·2 answers
  • Is iphone battery being draned if plugged into car charger when listening to podcasts
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!