Sectionย 1. Chapterย 12
single
Challenge: Generate and Transform Sequence
Swipe to show menu
Task
Swipe to start coding
Implement two functions:
generateSequence: takes an integernand returns astd::vector<int>of sizenfilled with random values. Usestd::generateto fill the vector. Generate random integers between 1 and 100 (inclusive).squareElements: takes aconst std::vector<int>&and returns a new vector where each element is the square of the corresponding input value. Usestd::transformfor this operation.
Solution
Everything was clear?
Thanks for your feedback!
Sectionย 1. Chapterย 12
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat