Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
294 B
1
Indexable
Never
#include <iostream>
using namespace std;
template <class t>
t sum(t a[] , int size){
t s = 0;	 
for (int i =0 ; i<size ; i++)
{
	s= s+s[i];
}
return s;
}
int main ()
{
	int x[5]= {1,2,3,4,5};
	float y[3]= {1.1 , 2.2 , 3.3};
	cout<<sum(8 , 5)<<endl;
	cout<<sum(x , y)<<endl;
}