#include #include using namespace std; template int sum(const array< int , SIZE >& x) { int t = 0; for (int i = 0; i < SIZE; ++i) t += x[i]; return(t); } template float sum(const array< float , SIZE >& x) { float t = 0; for (int i = 0; i < SIZE; ++i) t += x[i]; return(t); } template double sum(const array< double , SIZE >& x) { double t = 0; for (int i = 0; i < SIZE; ++i) t += x[i]; return(t); } int main() { const int n = 10; array x ; array y ; array z ; int i; for (i = 0; i < n; i++) x[i] = (i + 1); for (i = 0; i < n; i++) y[i] = (float)(i + 1); for (i = 0; i < n; i++) z[i] = (double)(i + 1); cout << sum(x) << endl; cout << sum(y) << endl; cout << sum(z) << endl; return(0); }