template 2b

Solutions on MaxInterview for template 2b by the best coders in the world

showing results for - "template 2b"
Adrian
18 Jun 2016
1// function templates
2#include <iostream>
3using namespace std;
4
5template <class T, class U>
6bool are_equal (T a, U b)
7{
8  return (a==b);
9}
10
11int main ()
12{
13  if (are_equal(10,10.0))
14    cout << "x and y are equal\n";
15  else
16    cout << "x and y are not equal\n";
17  return 0;
18}
queries leading to this page
template templatestemplatestemplate 2b