#include <iostream.h>
#include <conio.h>
template<class T>
T max(T A[], int dim)
{
T big = A[0];
for (int k = 1; k<dim; k++)
{
if (A[k] > big)
{
bit = A[k];
}
}
return big;
}
int X[10]={99, 123, 16, 200, 85, 27, 33, 80, 11, 73};
float Y[10]={48.17, 16.25 ,-1.27, -0.5, 172.0, 99.1, 2.3, 90.05, -325.79, 14.5};
int main()
{
clrscr();
int ilarge;
ilarge = max(X, 10); //instantiation of max()
cout<<"Maximum of array X = "<<ilarge<<endl
cout<<endl;
float flarge;
flarge = max(Y, 10); //instantiation of max()
cout<<endl;
cout<<"Maximum of array Y = "<<flarge<<endl;
getch();
return 0;
}
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement 
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

This program illustrates the function template instantiation where the template parameter list contains both template type and template non-type parameters.

 

 

 

 

 

 

 

 

 

                                                                                                                                          

1 This program creates a function template to find the square of a no. of type int and float.
2 This program is to define a function template to swap the contents of two data items of type int, float, and double.
3 This program illustrates the function templates instantiation.
4 This program illustrates the function template instantiation where the template parameter list contains both template type and template non-type parameters.
5 This program illustrates the template arguments with L value transformation.
6 This program illustrates the inclusion compilation model of the function template.
7 This program illustrates the function template explicit specialization.
8 This program illustrates the overloaded function templates.
9 This program illustrates the overloaded resolution of templates instantiation and an ordinary function call.

 

     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement