#include <iostream>
using namespace std;

// template function
template <class U>
U IsSmall(U x1, U x2)
{
	return (x1 < x2) ? x1 : x2;
}

template <class Q>
void SwapData(Q &m, Q &n)
{
	Q temp;
	temp = m;
	m = n;
	n = temp;
}


int main()
{
	int n1, n2;
	float f1, f2;
	char c1, c2;

	cout << "Enter two integers:\n";
	cin >> n1 >> n2;
	cout << IsSmall(n1, n2) << " is smaller." << endl;
	
	SwapData(n1, n2);
	cout << n1 << " -- " << n2 << endl;

	cout << "\nEnter two floating-point numbers:\n";
	cin >> f1 >> f2;
	cout << IsSmall(f1, f2) << " is smaller." << endl;

	SwapData(f1, f2);
	cout << f1 << " -- " << f2 << endl;

	cout << "\nEnter two characters:\n";
	cin >> c1 >> c2;
	cout << IsSmall(c1, c2) << " has smaller ASCII value." << endl;

	SwapData(c1, c2);
	cout << c1 << " -- " << c2 << endl;

	return 0;
}

