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
3 years ago
13

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

Computers and Technology
1 answer:
lilavasa [31]3 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
Please answer immediately!!!
diamong [38]

Answer:

Please check the attachment.

Remember:

All N1, N2, N3N, N4, N5, N6, N7 and each of them are certainly like the server. Also note that Router, repeaters, switch and transmitter are not mentioned in the above diagram. Please assume it in between each location.

Explanation:

Please check the attachment. Also, Remember that Server is at the head office, and rest 7 are the 7 branches. The VOIP, video surveillance, Door security system and the computer networks are being shown in the diagram. And each location has a network of computers joined through VLAN, and each of them are given the IP addresses of Class A, Class B and class C of the iPV4(or IPV6), which can be found by the future network administer, operators through the IP address, that is assigned.  

4 0
3 years ago
Is media good for the brain?
skad [1K]

Of course yes, and that depends of the type of content that you eaten =D

Media is a source of good information for to create your opinion.

Best regards

7 0
3 years ago
Read 2 more answers
In which generation of computers are we in?​
qwelly [4]
It should be the Sixth generation
4 0
3 years ago
Implement the function couple, which takes in two lists and returns a list that contains lists with i-th elements of two sequenc
In-s [12.5K]

Answer:

couple.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

s1=[1,2,3]

s2=[4,5,6]

print(couple(s1,s2))

enum.py

def couple(s1,s2):

  newlist = []

  for i in range(len(s1)):

      newlist.append([s1[i],s2[i]])

  return newlist

def enumerate(s,start=0):

  number_Array=[ i for i in range(start,start+len(s))]

  return couple(number_Array,s)

s=[6,1,'a']

print(enumerate(s))

print(enumerate('five',5))

Explanation:

7 0
3 years ago
What is SEO and SEM?
velikii [3]

Answer:

SEO stands for “search engine optimization.” In simple terms, it means the process of improving your site to increase its visibility for relevant searches.

SEM, or search engine marketing, is the act of using paid strategies to increase search visibility.

4 0
2 years ago
Other questions:
  • You use worksheets to perform calculations. How do you perform these calculations?
    15·2 answers
  • Write a function addOne that adds 1 to its integer referenceparameter. The function returns nothing.
    11·1 answer
  • (Help please I don't know what to choose because it's both text and email but I can only pick one. HELP!!!!!!!!!!)
    6·2 answers
  • When using the Internet, it is important to know the validity of web page you are using. How can you know if the information is
    5·1 answer
  • What does a computer need from people in order to solve problems effectively?
    9·1 answer
  • A ________ database state is one in which all data integrity constraints are satisfied
    15·2 answers
  • If the user enters any operator symbol other than , -, *, or /, then an UnknownOperatorException is thrown and the user is allow
    8·1 answer
  • Free 35 points!!!
    11·2 answers
  • Will give brainly if answer all or my questions
    8·1 answer
  • joe is in the planning stages to make sure that an upcoming company promotion during a major sporting event will not overwhelm h
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!