Exchange

Description:

Write a program to exchange the values of integer,float and character using function overloading. Input: First line contains Two integer numbers Second line contains Two floating point numbers Third line contains Two characters Test Case 1 Input (stdin) 5 6 5.5 6.6 h e Expected Output Values of int Value of int_1=6 Value of int_2=5 Values of float Value of float_1=6.6 Value of float_2=5.5 Values of char Value of char_1=e Value of char_2=h Test Case 2 Input (stdin) 3 4 3.3 4.4 i j Expected Output Values of int Value of int_1=4 Value of int_2=3 Values of float Value of float_1=4.4 Value of float_2=3.3 Values of char Value of char_1=j Value of char_2=i

Program :

#include <iostream>

using namespace std;

int main()

{

int a,b;

  float c,d;

  char e,f;

  cin>>a>>b>>c>>d>>e>>f;

  cout<<"Values of int";

  cout<<"\nValue of int_1="<<b<<"\nValue of int_2="<<a<<"\nValues of float"<<"\nValue of float_1="<<d<<"\nValue of float_2="<<c<<"\nValues of char"<<"\nValue of char_1="<<f<<"\nValue of char_2="<<e;

    return 0;

}