0
wap to find sum and average of two number using template function
please help me to do it faster
3 Answers
+ 1
#include <iostream>
using namespace std;
template <class T, class U>
T sum(T a, U b) {
return (a+b);
}
int main() {
cout<<"sum :-"<<sum(5,3)<<endl;
cout<<"ave :-"<<sum(5,3)/2<<endl;
}
https://code.sololearn.com/cUIFqIp7PASh/?ref=app
0
https://www.programtopia.net/cplusplus/docs/templates
0
estifanos tekiea i said using template function not template class