StudyLover
  • Home
  • Study Zone
  • Profiles
  • Contact us
  • Sign in
StudyLover 21. Program to implement function templates.
Download
  1. C++ Programs list
20. Program to find the maximum of two numbers using a friend function. : 22. Program to read and write binary data in a file.
C++ Programs list

1.      Program to implement function templates.

  1. #include <iostream.h>

  2. #include<conio.h>

  3. template <class T>

  4. T maximum(T x, T y) {

  5.     return (x > y) ? x : y;

  6. }

  7.  

  8. int main() {

  9.     int a = 10, b = 20;

  10.     double c = 3.14, d = 2.718;

  11.     cout<< "Enter 1st Number: ";

  12.     cin >> a;

  13.     cout << "Enter 2nd Number: ";

  14.     cin >> b;

  15.  

  16.     cout << "Maximum of " << a << " and " << b << " is: " << maximum(a, b) << endl;

  17.  

  18.     getch();

  19.     return 0;

  20. }

20. Program to find the maximum of two numbers using a friend function. 22. Program to read and write binary data in a file.
Our Products & Services
  • Home
Connect with us
  • Contact us
  • +91 82955 87844
  • Rk6yadav@gmail.com

StudyLover - About us

The Best knowledge for Best people.

Copyright © StudyLover
Powered by Odoo - Create a free website