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
salantis [7]
3 years ago
5

Write a void function using two type int call-by-reference parameters that swaps the values in the arguments. Be sure to include

testable pre and post conditions. .

Computers and Technology
1 answer:
liberstina [14]3 years ago
5 0
<h2>Answer:</h2>

Please copy the C++ code inluded. It's better to open it with an Integrated Development Environment of your choice.

Th C++ code includes explanatory comments (after "//"). You may run it on on step by step basis.

The void function code follows:

void swapFunction(int & a, int & b) {    // receives 2 references (&) as  a and b

int c = a;                                  // saves a's value (actually first's) to local variable c

a = b;                                      // assigns b's value (actually second's) to a (actually first's)

b = c;                                      // assigns to b (actually second) from c

}

<h3>Main function:</h3>

using namespace std;                        // Assumes "std::" prefix for "cin" and "cout"    

int main() {                                // Main program unit

int first,second;                           // We must declare 2 variables to store 2 int values (data input)

cout << "First value:"; cin >> first;       // Reads first value after a little message

cout << "Second value:"; cin >> second;     // Reads second value after a little message

swapFunction(first,second);                 // Swap function call sends first's and second's references

cout << "First value:" << first << endl;    // Displays new first value

cout << "Second value:" << second << endl;  // Displays new second value

return 0;                                   // Success exit returns 0

}

<h2>Explanation: The testable code is included as main function</h2>
  • It declares 2 int variables to store input data
  • Reads the input data
  • Calls swapFunction to swap values stored
  • Displays exchanged values

You might be interested in
Which operating system is a version of Linux?​
Lunna [17]

Answer:

MS-DOS

Explanation:

The only operating system which is a version of Linux.

3 0
3 years ago
The right to make others do things is referred to as _________.
Nady [450]

Answer:

I think B hope its right

3 0
3 years ago
Read 2 more answers
How can investors receive compounding returns
ANTONII [103]
If you’ve ever had a savings account, you likely know that a few cents in interest every month barely adds up. The goal is “compounding returns,” which simply means that the interest you earn each month earns additional interest, which then earns even more interest. But although a savings account will help with that, you may be lucky enough to be able to afford a cup of coffee every 10 years or so at that rate. Instead, it’s important to find a way to invest your money in a high-interest account that will earn compounding returns.

I hope this helps you out ;)
3 0
4 years ago
Which type of cable is used for high-capacity trunk lines that provide main routes for telephone, cable, and internet communicat
Readme [11.4K]

Answer:

Fiber-optic cable

Explanation:

Before the cable industry transitioned to fiber-optic cables, for many years, the standard cables used for telephone, cable, and internet communications were coaxial cables. The transition was made possible because the architecture of the fiber-optic cable came with a higher capacity, more extensive bandwidth link. Unlike the coaxial or the twisted pair cable, the fiber-optic is made from glass strands that transmit light signals much quicker and to greater distances. This makes fiber-optic cables the fastest high capacity data transfer link than any other cables to ever exist.

5 0
3 years ago
Examples of email use that could be considered unethical include _____.
AfilCa [17]

Answer:

"Denying receiving an e-mail requesting that you work late "

"Sending a quick message to your friend about last weekend "

"Sharing a funny joke with other employees"

Explanation:

Based off of the questions, I assume it means while you are at work. If you're at home or something, all of these are fine.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Using the drop-down menus, correctly complete the sentences.
    5·2 answers
  • If the task is to write firewall specifications for the preparation of a(n) ____, the planner would note that the deliverable is
    14·1 answer
  • In C++ Please:
    11·1 answer
  • Write a C function (NOT A COMPLETE PROGRAM)which takes three parameters which are the cost for an item in a grocery store, the q
    12·1 answer
  • What is the purpose of a diode in a cordless drill or power screwdriver?
    14·1 answer
  • . What is piracy? ???????????????????​
    5·1 answer
  • All operations used to construct algorithms belong to one of three categories: sequential, conditional, or iterative. Below is a
    15·1 answer
  • Which similar computer network components connect multiple devices?
    7·1 answer
  • If the tax percent is 15% and tax is $36 and percent discount is 10, what is the cost price?​
    12·1 answer
  • Why do digital media professionals create portfolios of their work?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!