Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 the output is: 8 3 Your program must define and call a function. SwapValues returns the two values in swapped order. void SwapValues(int

Respuesta :

Answer:

Written in C++

#include <iostream>

using namespace std;

void SwapValues(int num1, int num2) {

   int temp = num1;

   num1= num2;

   num2 = temp;

   cout<<num1<<" "<<num2;

}

int main() {

   int num1, num2;

   cout<<"Enter two integers: ";

   cin>>num1;

   cin>>num2;

SwapValues(num1,num2);

   return 0;

}

Explanation:

I've added the full program as an attachment where I used comments as explanation

Ver imagen MrRoyal