Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Vector Operations in Practice | Containers
C++ STL Containers and Algorithms

bookChallenge: Vector Operations in Practice

Tarea

Swipe to start coding

Implement two functions:

  • Define a function named createSequence that takes an integer argument n and returns a std::vector<int> containing the numbers from 1 to n (inclusive), in order;
  • Define a function named sumVector that takes a const std::vector<int>& as an argument and returns the sum of its elements as an integer.

Solución

solution.cpp

solution.cpp

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 2
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

close

Awesome!

Completion rate improved to 6.67

bookChallenge: Vector Operations in Practice

Desliza para mostrar el menú

Tarea

Swipe to start coding

Implement two functions:

  • Define a function named createSequence that takes an integer argument n and returns a std::vector<int> containing the numbers from 1 to n (inclusive), in order;
  • Define a function named sumVector that takes a const std::vector<int>& as an argument and returns the sum of its elements as an integer.

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 2. Capítulo 2
single

single

some-alt