/* TEMPFUN.CPP */ #include void tulosta(int i, int tila=1) { printf("Kokonaisluku on %*d\n",tila,i); } int tulosta(double d, int tila=1,int desi=2) { printf("Reaaliluku on %*.*lf\n",tila,desi,d); return 0; } template T max(T a,T b) { return a > b ? a : b; } template void swap(T &a, T &b) { T t; t = a; a = b; b = t; } int main(void) { int ia = 3 , ib = 5 ,ic = max(ia,ib); double da = 3.1, db = 5.2 ,dc = max(da,db); tulosta(ic); tulosta(dc); swap(ia,ib); tulosta(ia); tulosta(ib); swap(da,db); tulosta(da); tulosta(db); return 0; }