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
Romashka-Z-Leto [24]
3 years ago
8

Write a C++ program to exchange values of two variables using function exchange().

Computers and Technology
1 answer:
Shkiper50 [21]3 years ago
6 0

Answer:

#include<iostream>

using namespace std;

//create the exchange function

void exchange(int a, int b){

   int temp;  //initialize temporary

   //swap the variables value

   temp=a;

   a=b;

   b=temp;

   //print the output after exchange

   cout<<"a is: "<<a<<endl;

   cout<<"b is: "<<b<<endl;

}

//main function program start from here

int main(){

  //initialization

  int a=3, b=6;

  exchange(a,b);  //calling the function

  return 0;

}

Explanation:

Create the function exchange with two integer parameter which takes the value from the calling function.

and then declare the third variable temp with is used for swapping the value between two variables.

first store the value of 'a' in the temp and then assign the 'b' value to 'a' and then, assign the temp value to b.

for example;

a=2, b=9

temp=2;

a=9;

b=2;

So, the values are swap.  

and then print the swap values.

Create the main function and define the input a and b with values.

Then, calling the exchange function with two arguments.

You might be interested in
Lucinda is a network manager. She wants to set up a small office computer network so that it will not be affected at all by elec
Katena32 [7]

Answer:

The network media she should use is;

E. Shielded twisted-pair

Explanation:

A network connection that will not be affected by electrical or electromagnetic interference is a shielded twisted pair cable

Electromagnetic interference, EMI, is an externally originating disturbance that has an impact on electrical circuits through electromagnetic induction, direct conduction, or electrostatic coupling, with the possible effect of circuit degradation or disruption

EMI can be prevented by the use of shielded twisted pair (STP) cabling that provides a barrier that reduces the effect of external electromagnetic fields and transports the current induced to the ground through a grounding wire

4 0
3 years ago
What makes Darth Vader's sound so sinister, menacing and evil?
olganol [36]

Answer:

The volume, special effects, and the content of the speech.

Explanation:

The volume and special effects make all video productions's tone clearer. The words that Darth Vader speaks also adds to his "bad guy" character.

3 0
4 years ago
Read 2 more answers
Which of the following is the best way to add a lengthy explanation to Excel data without being limited to cell sizes and restri
trapecia [35]

Answer:

B

Explanation:

Which of the following is the best way to add a lengthy explanation to Excel data without being limited to cell sizes and restrictions? A. Adding a chart object B. Adding an Access object C. Adding a Word object D. Adding an Excel object microsoft word

Answer: B

6 0
3 years ago
What is the system of computers, routers, wires, cables,etc. that allow computers to communicate called?
Anika [276]
Internet maybe?
Not 100% sure though
5 0
3 years ago
1) Only analog signals can be used to transmit information.<br><br> a) True b) False
Contact [7]

Answer: False

Explanation:

Digital signal is used for transmission of information over a dedicated line wheres for using analog signal for transmission of information it is first converted to digital to be able to transfer it across long distances./

3 0
3 years ago
Other questions:
  • Two electronics technicians are looking at the piece of testing equipment shown in the figure above. Technician A says that this
    10·1 answer
  • Create a script that asks for the visitor's weight in pounds and his/her height in inches. The program should then calculate the
    13·1 answer
  • Which folders are commonly used in the navigation pane of outlook
    5·1 answer
  • If a firm's pages are not near the top of query results, customers may never discover its website. This has led to _____ becomin
    12·1 answer
  • The basic assumption that underlines event driven modeling is that the system can be represented as a model with an infinite num
    9·1 answer
  • The gradual wearing away or breaking down of rocks by abrasion is a type of __________________ weathering.
    8·1 answer
  • A life insurance salesperson who takes advantage of the foot-in-the-door phenomenon would be most likely to:________
    14·1 answer
  • Which format of image files can be inserted in html?​
    8·2 answers
  • A__ is a part of a GUI that allows a specific type of interaction with the user.
    14·1 answer
  • Write a function that receives a one-dimensional array of integers and returns a Python tuple with two values - the minimum and
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!