answersLogoWhite

0


Best Answer

#include<iostream>

template<typename T>

void exch(T& a, T& b)

{

T temp = a;

a = b;

b = temp;

}

int main()

{

int x=4, y=2;

exch(x,y);

}

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Program that will interchange the input numbers in c plus plus '?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the program to find sum of n natural numbers in c plus plus?

Initialise an unsigned integer to zero. As each number is input, increment the running total accordingly. When all numbers are input, display the total.


C plus plus program calculate the power value of input base and exponent numbers?

cn = c0 *( 1 + i ) pow n


How do you alternate the input numbers using for loop in c plus plus?

Input a variable.


A program c plus plus on automorphic numbers or not?

how to write a program that counts automorphic number from 1 to 999


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


What is credit card 'interchange'?

It is the cost of doing business plus interchange


What is a program to input any two numbers and print their sum and product by leaving two lines in between?

Since you didn't specify, I will give you the answer for a TI 83 Plus Silver Addition :Input A :Input B :ClrHome &lt;--found in the prgm menu with input :Output(1,1,A+B) &lt;--Output also found in same menu as ClrHome :Output(4,1,A*B)


How to write a C plus plus Program to convert a string into an integer?

std::string input = ""; std::getline (std::cin, input); // get input from stdin std::stringstream ss (input); // place input in a string stream integer num = 0; if (ss &gt;&gt; num) // extract integer from string stream { // Success! } else { // Fail! }


1 plus 3 plus 5 plus 7n how will you do this program?

Print "Type the upper limit (n) ?" Input n K = -1 WHILE K &lt; = n K = K + 2 Sum = Sum + K WEND Print "The sum of all odd numbers up to "; n; "is "; Sum


What year and model cars will have driver seat rails that will interchange with 1995 Dodge Stratus?

1996 Stratus will interchange, plus others.


A program of c plus plus to accept the string and display the alternate characters in reverse order using pointer?

The following program prints every second character of the input in reverse order. #include&lt;iostream&gt; #include&lt;sstream&gt; int main() { std::cout &lt;&lt; "Input:\t"; std::string input = ""; std::getline (std::cin, input); if (input.size()) { std::cout &lt;&lt; "Output:\t"; unsigned index = input.size() / 2 * 2; do { index -= 2; std::cout &lt;&lt; input[index]; } while (index); std::cout &lt;&lt; std::endl; } }


Is it possible to write a C plus plus or java program to draw an activity flow diagram given the sequence as a text file input and store the diagram in an output file?

Yes, this is possible.