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
german
4 years ago
13

Write a program in C++ to swap two variables usingfunctions?

Computers and Technology
1 answer:
lilavasa [31]4 years ago
8 0

Answer:

#include <iostream>

using namespace std;

void swap(int& m, int& n)  /* passing by reference so that changes will be made in the original values.*/

{

   int t=m;

   m=n;

   n=t;

}

int main()

{

   int val1,val2;

   cout<<"Enter the values"<<endl;

   cin>>val1>>val2;

   cout<<"Values before swap "<<val1<<" "<<val2<<endl;

   swap(val1,val2); //calling the function swap..

   cout<<"Values after swap "<<val1<<" "<<val2<<endl;

return 0;

}

Explanation:

Created a function swap with 2 arguments m and n passed by reference.

You might be interested in
An it department submits a purchase order to buy a new computer from a vendor. Which hardware lifecycle does this scenario belon
AnnZ [28]

Answer:

Purchase or Lease is the stage of the Hardware Lifecycle to which this scenario belongs to.

Explanation:

Stages of Hardware Lifecycle Management:

1. Plan

Plan is made to check which things are needed and will help us in short and long terms so, that it remains in budget and can give us more productivity.

2. Purchase or Lease

We do check whether we need to use the things for long term or short term. If long term we can buy it but, for short term we can always take it on lease.

3. Deploy & Install

New equipments are placed at required places for their usage.

4. Maintenance

We need to have maintenance service which are done by third-party companies so, that all equipments work smoothly.

5. Upgrade

We need our company to be efficient so, we do upgrade equipments like getting new version of it and to maintain that it work for long time.

6. Parts & Repair

If repairing of equipments are done it can serve for more longer time.

7. Extend

We can extend the equipments warranty period so, if any major component gets damaged it can get replaced or removed free of cost rather than spending extensive money.

8. Buyback or Trade In

We can sell the used equipments so, we can have extra money by which we have taken the work of equipment even and got price for it.

9. Dispose or Recycle

We should dispose or recycle after the time you realize it can't be used anymore or repairing it will be wastage of money. So, dispose or recycle it.

3 0
4 years ago
A company wants to transmit data over the telephone, but they are concerned that their phones may be tapped. All of their data i
erastovalidia [21]

Answer:

def encrypt_digit(digit):

   if type(digit) is int or float:

       digit = str(digit)

   hold = list()

   for x in digit:

       d = str((int(x) + 3)%10)

       hold.append(d)

   first = hold.pop(0)

   second = hold.pop(0)

   third = hold.pop(0)

   fourth = hold.pop()

   print(int("".join([third,fourth, first, second])))

encrypt_digit(7836)

Explanation:

The python function accepts a four-digit parameter which represents the data transmitted over the company's telephone network. The function encrypts the data by adding 3 to each digit and getting the modulus of division 10, then the digits are swapped and printed out encrypted and ready for transmission.

6 0
3 years ago
The Earth receives different amounts of energy from the Sun in each hemisphere because
Lady bird [3.3K]

Answer:

The Sun is much larger than the other stars. ... A planet has less mass than a galaxy and more mass than the star it orbits. A galaxy has less mass than a moon and more mass than a planet.

Explanation:

8 0
3 years ago
Read 2 more answers
Why is body language an important factor in a business meeting
slava [35]

The importance of the body language in business. Body language is a language without spoken words, it is called non verbal communication. We use it all the time in our social life and business life so it is all about gestures movements and expressions made by people to deliver a specific message to other people. Business meetings are all about making a good impression.

5 0
3 years ago
Point: A Point in a two dimensional plane has an integer x coordinate value and an integer y coordinate value.
UNO [17]

Answer:

They are connected

Explanation:

8 0
3 years ago
Other questions:
  • Assume the availability of a function called printStars. The function receives an integer value as an argument. If the argument
    8·1 answer
  • What directory under / contains the log files and spools for a linux system?â?
    13·1 answer
  • Which of the following statements about websites is NOT true?
    8·2 answers
  • What type of computer is likely to use so-dimms, have an internal power supply, and use a desktop processor socket?
    10·1 answer
  • Apollo Couriers, a company providing international express mail services, has a proactive customer communications team. The prim
    8·1 answer
  • What's a computers C hard drive
    13·2 answers
  • The following shared data structures must be declared as global variables such that they are shared by all threads
    7·1 answer
  • I’ll mark brainliest if correct
    10·1 answer
  • PLEASE HELP ILL GIVE BRAINIEST
    6·2 answers
  • 16 POINTS
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!