Challenge: Vector Operations in Practice
Task
Swipe to start coding
Implement two functions:
- Define a function named
createSequencethat takes an integer argumentnand returns astd::vector<int>containing the numbers from1ton(inclusive), in order; - Define a function named
sumVectorthat takes aconst std::vector<int>&as an argument and returns the sum of its elements as an integer.
Solution
solution.cpp
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 2
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Suggested prompts:
Can you explain this in simpler terms?
Can you give me an example?
What are the main benefits or drawbacks?
Awesome!
Completion rate improved to 6.67
Challenge: Vector Operations in Practice
Swipe to show menu
Task
Swipe to start coding
Implement two functions:
- Define a function named
createSequencethat takes an integer argumentnand returns astd::vector<int>containing the numbers from1ton(inclusive), in order; - Define a function named
sumVectorthat takes aconst std::vector<int>&as an argument and returns the sum of its elements as an integer.
Solution
solution.cpp
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 2
single