Challenge: Vector Operations in Practice
Opgave
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.
Løsning
solution.cpp
Var alt klart?
Tak for dine kommentarer!
Sektion 2. Kapitel 2
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Awesome!
Completion rate improved to 6.67
Challenge: Vector Operations in Practice
Stryg for at vise menuen
Opgave
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.
Løsning
solution.cpp
Var alt klart?
Tak for dine kommentarer!
Sektion 2. Kapitel 2
single