Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Sum Two Numbers with a Lambda | Introduction to Lambda Expressions
C++ Lambda Expressions

bookChallenge: Sum Two Numbers with a Lambda

Tarea

Swipe to start coding

Implement a function named sum that takes two integers as parameters. Inside the sum function, define a lambda expression that takes two integers and returns their sum. Call this lambda with the provided parameters and return the result from sum.

  • Define the sum function with two integer parameters.
  • Inside sum, create a lambda that adds the two integers.
  • Call the lambda with the parameters and return the result.
  • The program must include a main function as the entry point.

Solución

solution.cpp

solution.cpp

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 3
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Suggested prompts:

Can you explain this in simpler terms?

What are the main points I should remember?

Can you give me an example?

close

Awesome!

Completion rate improved to 12.5

bookChallenge: Sum Two Numbers with a Lambda

Desliza para mostrar el menú

Tarea

Swipe to start coding

Implement a function named sum that takes two integers as parameters. Inside the sum function, define a lambda expression that takes two integers and returns their sum. Call this lambda with the provided parameters and return the result from sum.

  • Define the sum function with two integer parameters.
  • Inside sum, create a lambda that adds the two integers.
  • Call the lambda with the parameters and return the result.
  • The program must include a main function as the entry point.

Solución

solution.cpp

solution.cpp

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 3
single

single

some-alt