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
The multitasking, multi-user, operating system developed by Bell Laboratories that operates on a wide variety of computing platf
olasank [31]

Answer:

Unix

Explanation:

UNIX is simply an operating system developed by Bell Laboratories in the 1960s. Ever since then, it has been constantly worked upon and developed. It is an operating system because it is a suite of programs capable of making a computer to function. Unix is considered to be a stable, multi-user, and multi-tasking system for both desktops and laptops and even servers.

8 0
3 years ago
Create a Python program as described below and save it in a file named bool. You should use IDLE or similar environment to creat
Eva8 [605]

PYTHON CODE

# function to compare a and b
def compare(a,b):

    # if a is greater than b , return 1
    if a > b:
        return 1

    # if a and b are equal, return 0
    elif a == b:
        return 0

    # if a less than b , return -1
    elif a < b :
        return -1


# testing
if __name__=="__main__":

    # calling the compare function with a and b
    print('compare(5,2) %d'%compare(5,2))
    print('compare(2,5) %d'%compare(2,5))
    print('compare(3,3) %d'%compare(3,3))

    # getting values for a and b
    a=int(input("Enter the value for a: "))
    b=int(input("Enter the value for b: "))

    print('compare(%d,%d) %d'%(a,b,compare(a,b)))

(see attachment for output)

8 0
3 years ago
Which shortcut keys can be used to duplicate a slide?
Leya [2.2K]

Answer:

Ctrl + D used to duplicate a slide

8 0
3 years ago
What is the half of 3/18
Zarrin [17]

Answer:

1/3

Explanation:

3/18 divided by 2 equals 1/3

hope this helps

have a good day

5 0
2 years ago
_______ data would be useful for creating a weekly status report for your manager that should reflect changes in real time.     
elena55 [62]
D. Field data because that it a report of what happened over the week that a manager can reflect on for possible changes.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Chris has just graduated from high school. He hopes to complete a carpenter's apprenticeship and eventually open his own busines
    9·2 answers
  • The set of appearance choices for files and folders is known as the
    7·1 answer
  • Angle, oblique, regular, demi, roman, heavy, extra bold, expanded, and compressed are ___________ . Select one: A. type styles B
    10·1 answer
  • Which type of cloud computing offers easily accessible software and applications on the machines?
    7·1 answer
  • A trust domain is defined as Select one: a. The agreed upon, trusted third party b. A scenario where one user needs to validate
    5·2 answers
  • Complete the function to return the factorial of the parameter using recursion,
    10·2 answers
  • How can we style the images and layouts of our pages?
    8·1 answer
  • You have a technical interview for a new position in digital media. One of the questions you are asked is this: “A client asks y
    13·1 answer
  • If you use a new HTML5 input type (such as "range" or "number") on an older browser,
    12·1 answer
  • How can we search person in brainly for sending request of friend
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!