#include <iostream>
using namespace std;
template <class T>
T accumulator(int count)
{
T d, sum = 0;
for (int i = 0; i < count; ++i){
cout << "data" << i << " = ";
cin >> d;
sum += d;
}
return sum;
}
int main()
{
cout << "input int x4: " << endl;
int s1 = accumulator<int>(4);
cout << "int sum: " << s1 << endl << endl;
cout << "input float x5: " << endl;
float s2 = accumulator<float>(5);
cout << "float sum: " << s2 << endl << endl;
cout << "input double x4: " << endl;
double s3 = accumulator<double>(4);
cout << "double sum: " << s3 << endl;
return 0;
}