C++ Programming Blog

 
 
 
# include <iostream.h>
# include <conio.h>

template <class T>
void acc(T a)
{
    T *v;
   cout<<\"\\n ENTER THE LIMIT OF THE ARRAY:->\";
   int n;
   cin>>n;
   v=new T[n];
   cout<<\"\\n ENTER THE VALUES IN IT:->\";
   for(int i=0;i<n;i++){
          cin>>v[i];
   }
   cout<<endl<<endl;
   for(int i=0;i<n;i++)
       cout<<v[i]<<\" \";
   getch();
}

void main()
{
    acc(1);
   getch();
}

 
 
Didn't find what you were looking for? Find more on Template based array input