write a c++ ,program to use function overloading with function template ( max two value)
// C++ program to demonstrate the
// function overloading
#include <bits/stdc++.h>
using namespace std;
// Function to calculate square
void square(int a)
{
cout << "Square of " << a
<< " is " << a * a
<< endl;
}
// Function to calculate square
void square(double a)
{
cout << "Square of " << a
<< " is " << a * a
<< endl;
}
// Driver Code
int main()
{
// Function Call for side as
// 9 i.e., integer
square(9);
// Function Call for side as
// 2.25 i.e., double
square(2.25);
return 0;
}
Comments
Leave a comment