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

Write the definition of a function named swapints that is passed two int variables. The function returns nothing but exchanges t

he values of the two variables. So, if j and k have (respectively) the values 15 and 23, and the invocation swapints(j,k) is made, then upon return, the values of j and k will be 23 and 15 respectively.
Computers and Technology
1 answer:
lisov135 [29]3 years ago
4 0

Answer:

Following are the program in the C++ Programming Language.

#include <iostream>

//header file

using namespace std;

 //using namespace

void swapints(int &j, int &k){

 //definition of the function

int temp;

temp = j;

j = k;

k = temp;

}

// function declaration

void swapints(int &j, int &k);

int main() {

  // local variable declaration:

 int j = 15;

 int k = 23;

 std::cout << "Before the swapping, value of j : "<<j<<endl;

 std::cout << "Before the swapping, value of k : "<<k<<endl;

  /* calling a function to swap the values using variable reference.*/

 swapints(j, k);

 std::cout << "After the swapping, value of j : "<<j<< endl;

 std::cout << "After the swapping, value of k : "<<k<< endl;

 

  return 0;

}

Output:

Before the swapping, value of j : 15

Before the swapping, value of k : 23

After the swapping, value of j : 23

After the swapping, value of k : 15

Explanation:

Here, we define the header fine and namespace <iostream> and "std".

Then, we define a function named "swapints()" and pass two reference variables in parameter.

Then, inside the function, we perform the codes of swapping.

Then, we define the main() function inside it we define two integer variable "j" and "k" assign value "j" to 15 and "k" to 23 and print both the variables.

Then, inside main() function we call the function "swapints()" and pass value to its parameters.

You might be interested in
Is phone data used when connected to wifi
finlep [7]
I do not think so, no.
7 0
3 years ago
A laptop gets replaced if there's a hardware issue. Which stage of the hardware lifecycle does this scenario belong to?
Ilya [14]

Answer: Maintenance. This is the stage where software is updated and hardware issues are fixed if and when they occur. Retirement. In this final stage, hardware becomes unusable or no longer needed and it needs to be properly removed from the fleet

Explanation:

3 0
3 years ago
What is a graphical user interface (GUI)?
o-na [289]

The answer is D - A user-friendly computer program that allows the user to point and click on icons to make the computer function.


4 0
4 years ago
23
bezimeni [28]
I think the answer is c
7 0
3 years ago
How does the movement of earth in space create cycles we all experience?
Contact [7]
Actually, humans can not feel the Earth's movement because of our atmosphere(:
5 0
4 years ago
Other questions:
  • Write a program that takes nouns and forms their plurals on the basis of these rules:
    8·1 answer
  • How useful do you find the creation of folders in your computer?
    8·2 answers
  • Assume a 8x1 multiplexer’s data inputs have the following present values: i0=0, i1=0, i2=0, i3=0, i4=0, i5=1, i6=0, i7=0. What s
    8·1 answer
  • Finding your style in photography is about ___
    10·2 answers
  • hard disk drive has 16 platters, 8192 cylinders, and 256 4KB sectors per track. The storage capacity of this disk drive is at mo
    13·1 answer
  • Insufficient vacuum will require the driver to _______________ to adequately activate the brakes?
    13·1 answer
  • If you need any answer answered faster check out Wolframalpha.com
    14·2 answers
  • The capacity of your hand drive is measured in​
    12·1 answer
  • PYTHON!
    13·1 answer
  • When one loop appears inside another, the loop that contains the other loop is called the ____ loop. Group of answer choices ind
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!