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
Difference between entropy and enthalpy is
olchik [2.2K]

Answer:

Explanation:

Enthalpy is the measure of total heat present in the thermodynamic system where the pressure is constant. Entropy is the measure of disorder in a thermodynamic system.

3 0
2 years ago
Sketch f(x) = 5x2 - 20 labelling any intercepts.​
Norma-Jean [14]

Answer:

  • The graph of the function is attached below.
  • The x-intercepts will be: (2, 0), (-2, 0)
  • The y-intercept will be: (-20, 0)

Explanation:

Given the function

f\left(x\right)\:=\:5x^2-\:20

As we know that the x-intercept(s) can be obtained by setting the value y=0

so

y=\:5x^2-\:20

switching sides

5x^2-20=0

Add 20 to both sides

5x^2-20+20=0+20

5x^2=20

Dividing both sides by 5

\frac{5x^2}{5}=\frac{20}{5}

x^2=4

\mathrm{For\:}x^2=f\left(a\right)\mathrm{\:the\:solutions\:are\:}x=\sqrt{f\left(a\right)},\:\:-\sqrt{f\left(a\right)}

x=\sqrt{4},\:x=-\sqrt{4}

x=2,\:x=-2

so the x-intercepts will be: (2, 0), (-2, 0)

we also know that the y-intercept(s) can obtained by setting the value x=0

so

y=\:5(0)^2-\:20

y=0-20

y=-20

so the y-intercept will be: (-20, 0)

From the attached figure, all the intercepts are labeled.

8 0
2 years ago
Let PALINDROME_DFA= | M is a DFA, and for all s ∈ L(M), s is a palindrome}. Show that PALINDROME_DFA ∈ P by providing an algorit
denis-greek [22]

Answer:

Which sentence best matches the context of the word reticent as it is used in the following example?

We could talk about anything for hours. However, the moment I brought up dating, he was extremely reticent about his personal life.

Explanation:

Which sentence best matches the context of the word reticent as it is used in the following example?

We could talk about anything for hours. However, the moment I brought up dating, he was extremely reticent about his personal life.

8 0
2 years ago
How many 32 bit integers can be stored in 16 byte cache block in matlab?
Sladkaya [172]
Bytes have eight bits. 32 bits would be four bytes.
4 0
3 years ago
In traditional programming, probably the most often used error-handling outcome was to ____.Group of answer choicesterminate the
iVinArrow [24]

In traditional programming, probably the most often used error-handling outcome was to terminate the program in which the offending statement occurred.

<h3>What is a traditional programming?</h3>

Traditional programming is known to be a form of manual way that one or a user makes a program.

Note that in the case above, In traditional programming, probably the most often used error-handling outcome was to terminate the program in which the offending statement occurred.

Learn more about programming from

brainly.com/question/23275071

#SPJ1

4 0
2 years ago
Other questions:
  • The title bar of a window tells you the name of the document or program that's being displayed in the window, and it also serves
    11·1 answer
  • You must have an active ____ to test external links.
    5·1 answer
  • An important task that the operating system performs is ____, which keeps track of the files stored on a computer so that they c
    15·1 answer
  • Name the different type of vegetation found in India ?​
    8·2 answers
  • Convert 578.2 into hexadecimal​
    9·1 answer
  • A variable that can be modified from anywhere within a program is called a?
    5·1 answer
  • According to the government, employees have a right to understand the risks associated with the materials they work with.
    15·1 answer
  • Why do people still use Intel HD graphics for gaming?
    8·1 answer
  • Shelby wants to move “ExpirationDate” to the top of the datasheet. What should she do?
    13·1 answer
  • Se numeşte permutare a unei mulţimi finite orice rearanjare a tuturor elementelor acelei mulţimi.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!