title: C++ function templates
body: <p>I wrote down this program in c++ to find out the largest among three numbers using function templates. I dont know why am I getting an error that Tx, Ty and Tz is not declared in the scope.
  Please help me out with this code. </p>
  
  <pre><code>#include &lt;iostream&gt;
  
  //Program to find out the largest among the three given numbers using function template
  
  using namespace std;
  
  template&lt;class T&gt;
  
  T greatest(Tx, Ty, Tz){
  if(x&gt;y){
      if(x&gt;z){
              return x;
      }
      else{
  
          return z;
  
      }
  }
  else if(y&gt;x){
          if(y&gt;z){
              return y;
  
          }
          else{
              return z;
  
          }
  
  
  
  }
  
  }
  int main()
  {
  int choice;
  int a,b,c;
  float x,y,z;
  double p,q,r;
  char option;
  
  do{
      cout&lt;&lt;"Find the greatest numbers"&lt;&lt;endl;
      cout&lt;&lt;"1. Among integer numbers"&lt;&lt;endl;
      cout&lt;&lt;"2. Among float numbers"&lt;&lt;endl;
      cout&lt;&lt;"3. Among double numbers"&lt;&lt;endl;
  
      cin&gt;&gt;choice;
  
      switch(choice){
      case 1:
          cout&lt;&lt;"Enter three Integer numbers"&lt;&lt;endl;
          cin&gt;&gt;a&gt;&gt;b&gt;&gt;c;
          cout&lt;&lt;"The greatest integer is "greatest(a,b,c)&lt;&lt;endl;
      case 2:
          cout&lt;&lt;"Enter three floating numbers"&lt;&lt;endl;
          cin&gt;&gt;x&gt;&gt;y&gt;&gt;z;
          cout&lt;&lt;"The greatest float number is "greatest(a,b,c)&lt;&lt;endl;
      case 3:
          cout&lt;&lt;"Enter three double numbers"&lt;&lt;endl;
          cin&gt;&gt;p&gt;&gt;q&gt;&gt;r;
          cout&lt;&lt;"The greatest float number is "greatest(p,q,r)&lt;&lt;endl;
  
      }
  
  
  cout&lt;&lt;"Do you want to continue (y/n)"&lt;&lt;endl;
  cin&gt;&gt;option;
  }while(option=='y' || option=='Y');
  return 0;
  }
  </code></pre>