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
Harman [31]
3 years ago
8

Assume that a function named swapdoubles has been defined and is available for use in this exercise: that function receives two

variables of type double and exchanges their values. Write the definition of a function named sort3 that is passed three double variables. The function returns nothing but modifies the values of these variables so they are in sorted order. So, if a, b and c have (respectively) the values 3.14, 2.71, and 3.04, and the invocation sort3(a,b,c) is made, then upon return, the values of a, b and c will be 2.71, 3.04, and 3.14 respectively.
Computers and Technology
1 answer:
Nata [24]3 years ago
6 0

Answer:

C++ Code:

void sort3(double &a, double &b, double &c)

{

   if(a > b)

       swapdoubles(a,b);

   if (b > c)

       swapdoubles(b,c);

   if (a > b)

       swapdoubles(a,b);

}

Explanation:

To change the values of a,b,c within the function, we pass the values by reference. Let us assume that number a = 3.14, b = 2.71, c = 3.04. Since a > b, values of a and b will be swapped.Now a = 2.71 and b = 3.14. Similariy, since b > c, they will be swapped. This way, we move the largest number to its correct position in the first two steps. If there are only three numbers, and the largest number is in its correct position, then for the two remaining numbers, we will only need atmost one swap to exchange their positions. hence, we perform a comparison of a > b once again to see if the b is smaller than a. if its not, then all a,b,c are in sorted order.

You might be interested in
Which of the following describes the term "false information?"
pav-90 [236]
Inaccurate and misleading
3 0
3 years ago
Design a flowchart or pseudocode for a program that accepts three numbers from a user and displays a message if the sum of any t
Keith_Richards [23]

Answer:

Hi there! Pseudocode is the process of writing out the high-level structure of the program in simple English terms which acts as a blueprint of how the program will work. The pseudocode for this question is written below.

Explanation:

Prompt user for input 1

Validate input 1

Prompt user for input 2

Validate input 2

Prompt user for input 3

Validate input 3

Perform checks:

If  

 1 and 2 equals 3

 Or

 1 and 3 equals 2

 Or

 2 and 3 equals 1

Display message to user

6 0
2 years ago
_______ an embedded Word table to activate the Word features.
Bess [88]
The answer is C. double-click
3 0
3 years ago
The___is a waterproof fabric that is placed around your camera
Zina [86]
Can you help me with homework and the answer is a circle
5 0
3 years ago
help:(What are the uses of various lights? How are they all different? How do you decide on their usage? How can you use natural
Monica [59]

Answer:

This is one of the most common types of lighting. Ambient light is a soft glow that blankets your space just enough for you to function without causing a harsh glare. In photography and cinematography, ambient light is considered the "natural light" within a room. In décor, ambient light is very similar, except you create the ambient light by making the room's lighting as natural and flat as possible. While ambient light is meant to get you safely from point A-to-B, it is not ideal for working closely with things or to highlight things around your space. When used correctly, ambient light creates a fantastic environment to relax from an overly stressful day or to have a warm conversation with an old friend. Ambient lighting is often referred to as mood lighting, because this light captures the soft curves of your face and allows your pupils to dilate slightly (a physical sign of affection). Some yoga studios have even begun using the softer ambient lighting in their classes to help draw stress from the body. This is a smaller more concentrated light. You want task lighting around when you’re working. In fact, some people call it office lighting. Task lighting is meant to help you see when you’re doing projects in which you need a finer light, such as, reading, cooking, writing, sewing and many other things. Task lighting only works well when it is used as a contrasting light. For example, if you have a low lit room with a swing arm lamp turned on over your desk, the light over the desk surface will be more effective with less glare or shadow-effect than if the entire room was lit with a brighter light. Task lighting helps naturally stimulate your brain. The contrasting light allows you to be more alert and concentrated. This will help you see more details as you work, creating higher quality results. This is why many businesses choose to use task lighting in their offices.

Explanation:

5 0
3 years ago
Other questions:
  • True false you cannot fill in a callout​
    14·1 answer
  • Store programming components in the shared folder. you want to secure the data in the folder as follows: members of the research
    11·1 answer
  • Write an application that inputs a telephone number as a string in the form (555) 555-5555. The application should use String me
    10·1 answer
  • If variable x has value 2 and y has value 2, what is the value of the following Jack expression?
    9·1 answer
  • You find that you are missing a very important file. After much searching, you have determined that it is no longer on your comp
    13·2 answers
  • HELP QUICKLY!!! IF YOUR RIGHT I'LL MARK YOU BRAINLIEST
    15·2 answers
  • ____ occurs when two nodes simultaneously check a channel, determine that it is free, and begin to transmit.
    9·1 answer
  • Which of these lines of code will increment a variable?
    11·1 answer
  • TOT al<br>Name TWO examples of these settings and utilities. (2)​
    12·1 answer
  • I need simple app ideas for basic problems<br>​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!