Q:

Write a lambda that takes two ints and returns their sum

0

Write a lambda that takes two ints and returns their sum.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>

int main() {
  auto sum = [](int a, int b) { return a + b; };

  int a, b;
  std::cin >> a >> b;
  std::cout << a << " + " << b << " = " << sum(a, b) << std::endl;

  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now