#include <iostream>
using namespace std;
template <class T>
T displayresult(T n1, T n2)
{
return n1/n2;
}
int main() {
float a,b;
cin>>a>>b;
cout<<a<<endl<<b<<endl<<displayresult(a,b);
return 0;
}
using namespace std;
template <class T>
T displayresult(T n1, T n2)
{
return n1/n2;
}
int main() {
float a,b;
cin>>a>>b;
cout<<a<<endl<<b<<endl<<displayresult(a,b);
return 0;
}
test case 5 error
ReplyDeleteTake 3 inputs
ReplyDeletefloat a,b,c;
cin>>a>>b;
c=displayresult(a,b)
cout<<a<<endl<<b<<endl<<c;
1.Remove the space in third line after template and before <.
ReplyDelete2.Remove the space in fourth line after , and before T n2.
works 100%
works
Delete#include
ReplyDeleteusing namespace std;
template
T displayresult(T n1, T n2)
{
return n1/n2;
}
int main() {
float a,b;
cin>>a>>b;
cout<<a<<endl<<b<<endl<<displayresult(a,b);
return 0;
}
template largest num ans:
ReplyDelete#include
using namespace std;
template
T Large(T n1,T n2)
{
if(n1>n2)
{cout<>a>>b>>c>>d;
Large(a,b);
cout<<"\n";
Large(c,d);
return 0;
}