StaffCoder
C+
C++C++
6 modules · 26 challengesSign up
Module 5 of 6 · 5 challenges

C++ Vectors & Arrays

Learn how to collect and filter values in std::vector, work with fixed-size std::array, find items with iterators and std::find, sort copies and compute a median, and summarise a two-dimensional grade book.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

5 challenges

Score Collector

Sign up to unlock
—No data yeteasy
About this challenge

Filter, count, average and update test scores held in a std::vector with push_back, size and range-for loops.

Solved in a browser IDE and graded by tests. Sign up to solve

Weekly Minutes Grid

Sign up to unlock
—No data yeteasy
About this challenge

Total a fixed five-day week held in a std::array, and build and sum two-dimensional seating grids made of nested std::vector rows.

Solved in a browser IDE and graded by tests. Sign up to solve

Roster Lookup

Sign up to unlock
—No data yeteasy
About this challenge

Search a std::vector of names with iterators and std::find: test membership, turn an iterator into an index, copy the tail after a match and erase the first match.

Solved in a browser IDE and graded by tests. Sign up to solve

Ranked Scores

Sign up to unlock
—No data yeteasy
About this challenge

Rank test scores with std::sort and the default ordering: a sorted copy, the median of an odd or even count, and the top three marks.

Solved in a browser IDE and graded by tests. Sign up to solve

Grade Book Stats

STAR
Solving it completes the module
—No data yeteasy
About this challenge

Compute grade book statistics over a table of marks kept as nested std::vector rows: means, medians, the top student, weighted marks, roster lookups, best marks and a capped curve.

Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.