c++ templates implementing on structures
<p>There is something wrong with this C++ code. I've compiled it in VC ++ 6.0. It's giving the error "cannot deduce template argument for type"... The problem is in the <code>display</code> function.</p>

<p>Here's the code:</p>

<pre><code>#include "stdafx.h"
#include &lt;iostream&gt;
#include &lt;conio.h&gt;
using namespace std;

template &lt;class type&gt;  
struct one
{
  type data;
  one *next;
};

one&lt;int&gt; *head, *temp, *mid, *del = NULL;

template &lt;class type&gt;
void athead(type value)    
{    
  one *node = new one;    
  node-&gt;data = value;    
  node-&gt;next = head;    
  head = node;
}

template &lt;class type&gt;
void add_at_tail(type value)   
{
  one *node = new one;   
  node-&gt;data = value;    
  node-&gt;next = NULL;

  if(head == NULL)
  {
    head = node;   
    temp = head;
  }

  while(temp-&gt;next != NULL)   
  {
    temp = temp-&gt;next;
  }

  if(temp != node)
  {
    temp-&gt;next = node;  
  }
}

template &lt;class type&gt;
void display()
{
  one&lt;type&gt; *temp = new one;
  temp = head;  
  cout &lt;&lt; "\n\n" &lt;&lt; endl;   
  while(temp != NULL)   
  {
    cout &lt;&lt; " " &lt;&lt; temp-&gt;data &lt;&lt; " " &lt;&lt; "-&gt;";
    temp = temp-&gt;next;
  }
  cout &lt;&lt; "\n\n\n";
}

int main()
{
  int a, b, c;
  cout &lt;&lt; "Enter the data: " &lt;&lt; endl;
  cin &gt;&gt; a;
  add_at_tail(a);
  cout &lt;&lt; "Enter the data: " &lt;&lt; endl;
  cin &gt;&gt; b;
  add_at_tail(b);
  cout &lt;&lt; "Enter the data: " &lt;&lt; endl;
  cin &gt;&gt; c;
  add_at_tail(c);

  display();

  return 0;
}
</code></pre>
