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
To keep information beyond reach of unauthorized users, is to keep the information _____. Group of answer choices simple verifia
nasty-shy [4]

Answer:

Secure is the correct answer for the above question.

Explanation:

  • When any person wants that any information is not hacked by any user then he needs to secure the information with the help of any security mechanism. This security mechanism can be of any type that facilities the user to stop the information are being hacked.
  • The above question asked about the work which is needed to stop the message is being hacked. So there is a need to secure the information. so secure is the correct option while the other option is not valid because "simple, economical or verifiable" can not stop the message from accessed by the unauthorized user.
7 0
3 years ago
Which of the following activities are performed by computer programmers? Choose all that apply.
AleksAgata [21]

Answer:

- They write step by step instructions for a computer to follow.

- They create a logic problem that the computer program can solve.

3 0
3 years ago
Why are there so many unit testing tools? Are they efficient? Why or why not?
sineoko [7]

Answer:

 Unit testing is the software testing method in which the individual source code are associate to control data. Unit testing basically test the code to ensure that the data or information meets its design.

The aim of unit testing that each part isolate in the program and display the correct individual parts.

Unit testing tool are efficient as they provide several benefits in the development cycle. The basic efficiency of unit testing tools depend upon its type of testing. Unit testing basically validate the units of source code in the program.

For example: when the loop and function in the program work efficiently.

5 0
3 years ago
Do you play Rocket League
lakkis [162]
Yessirrr like 3 times a week
6 0
3 years ago
Read 2 more answers
Write an efficient C++ function that takes any integer value i and returns 2^i ,as a long value. Your function should not multip
Ilya [14]

Answer:

long power(int i)

{

   return pow(2,i);

}

Explanation:

The above written function is in C++.It does not uses loop.It's return type is long.It uses the function pow that is present in the math library of the c++.It takes two arguments return the result as first argument raised to the power of second.

for ex:-

pow(3,2);

It means 3^2 and it will return 9.

4 0
3 years ago
Other questions:
  • Raeball was a lovin doll. And she spoke her mind as she stood tall. She made you special and loved. You're missed by so many. An
    10·2 answers
  • What can you use with your keywords to narrow your search if you complete an internet search using a search engine and do not ge
    15·2 answers
  • An example of a current disruptive technology is a?
    8·2 answers
  • The main disadvantage of using this device is its negative impact on network performance,resulting from the fact that any incomi
    10·1 answer
  • A web page ____ can also create a style sheet that takes precedence over the internal style sheets of browsers.
    10·1 answer
  • Given the variable ip, already declared as a pointer to an integer, write the code to dynamically allocate memory for a single i
    15·1 answer
  • you have a small network in your business with just a few network devices connected along with 22 linux computers and you want t
    7·1 answer
  • Miguel owns a tile business. He has two employees who work in a small office. One answers phones and schedules appointments. Ano
    11·2 answers
  • How do news organizations primarily create revenue?
    12·2 answers
  • I need subscribers plz ​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!