Скачиваний:
18
Добавлен:
15.06.2014
Размер:
1.95 Кб
Скачать
яю !++, B0: 65 :0: 8 4;O :;0AA0, 4;O DC=:F88 (3;>10;L=>9, B> 5ABL =5 O2;ONI59AO  :><?>=5=B>9-DC=:F859) <>65B  1KBL  >?8A0= H01;>=. -B>  ?>72>;8B A=OBL 4>AB0B>G=> 65AB:85 >3@0=8G5=8O, =0:;04K205<K5 <5E0=87<>< D>@<0;L=KE 8 D0:B8G5A:8E ?0@0<5B@>2 ?@8 2K7>25 DC=:F88.  0AA<>B@8< MB> =0 ?@8<5@5 DC=:F88, 2KG8A;ONI59 AC<<C =5A:>;L:8E 0@3C<5=B>2. 



template <class T1,class T2> 

T1 sm(T1 a,T2 b)   // >?8A0=85 H01;>=0 

{ return (T1)(a+b);  // DC=:F88 c 2 ?0@0<5B@0<8 

}                           

template <class T1,class T2,class T3> 

T1 sm(T1 a,T2 b,T3 c) // >?8A0=85 H01;>=0 DC=:F88

{ return (T1)(a+b+c);    // DC=:F88 c 3 ?0@0<5B@0<8 

} 

void main() 

{cout<<"2K7>2 D-F88 AC<<8@>20=8O sm(int,int)        =   "<<sm(4,6)<<endl; 

  cout<<"2K7>2 D-F88 AC<<8@>20=8O sm(int,int,int)   = "<<sm(4,6,1)<<endl; 

  cout<<"2K7>2 D-F88 AC<<8@>20=8O sm(int,double)  = "<<sm(5,3)<<endl; 

  cout<<"2K7>2 D-F88 AC<<8@>20=8O sm(double,int,short)= " << 

  sm(.4,6,(short)1)<<endl; 

}