#include <iostream>
using namespace std;
template <class T>
T sum(T n1, T n2, T n3, T n4, T n5)
{
return n1+n2+n3+n4+n5;
}
int main() {
int a,b,c,d,e;
float f,g,h,i,j;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
cout<<sum(a,b,c,d,e)<<endl;
cout<<sum(f,g,h,i,j);
return 0;
}
using namespace std;
template <class T>
T sum(T n1, T n2, T n3, T n4, T n5)
{
return n1+n2+n3+n4+n5;
}
int main() {
int a,b,c,d,e;
float f,g,h,i,j;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
cout<<sum(a,b,c,d,e)<<endl;
cout<<sum(f,g,h,i,j);
return 0;
}
giving 83% evaluation
ReplyDelete3rd line- remove the space between template and
Delete#include
ReplyDeleteusing namespace std;
template
T sum(T a,T b,T c,T d,T e)
{
float h;
h=(a+b+c+d+e);
cout<>a>>b>>c>>d>>e;
cin>>q>>w>>r>>t>>y;
sum(a,b,c,d,e);
sum(q,w,r,t,y);
}
#include
ReplyDeleteusing namespace std;
template
T sum(T n1, T n2, T n3, T n4, T n5)
{
return n1+n2+n3+n4+n5;
}
int main() {
int a,b,c,d,e;
float f,g,h,i,j;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
cout<<sum(a,b,c,d,e)<<endl;
cout<<sum(f,g,h,i,j);
return 0;
}
#include
ReplyDeleteusing namespace std;
template
T sum(T n1, T n2, T n3, T n4, T n5)
{
return n1+n2+n3+n4+n5;
}
int main() {
int a,b,c,d,e;
float f,g,h,i,j;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
cout<<sum(a,b,c,d,e)<<endl;
cout<<sum(f,g,h,i,j);
return 0;
}
replce "typename" with "class" in the 3rd line
ReplyDelete