Question: Revise the following short program so that it uses a lambda expression instead of f1(). Dont change show2(). #include template void show2(double x, T& fp)
Revise the following short program so that it uses a lambda expression instead of f1(). Don’t change show2().
#include
template
void show2(double x, T& fp) {std::cout << x << " -> " << fp(x) << '\n';}
double f1(double x) { return 1.8*x + 32;}
int main()
{
show2(18.0, f1);
return 0;
}
Step by Step Solution
3.40 Rating (159 Votes )
There are 3 Steps involved in it
include templat... View full answer
Get step-by-step solutions from verified subject matter experts
