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

C++ Structs & Enums

Learn how to model records with structs and aggregate initialisation, search vectors of structs with iterator loops, use enum class values in switches and as array indexes, and summarise a warehouse inventory by category.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Stock Records

Sign up to unlock
—No data yeteasy
About this challenge

Build, read and return warehouse records held in given structs with aggregate and designated initialisation.

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

Stock Search

Sign up to unlock
—No data yeteasy
About this challenge

Search and update a std::vector of structs by field with an iterator loop and it->: find a SKU, total the units, list low stock and correct a quantity.

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

Bin Categories

Sign up to unlock
—No data yeteasy
About this challenge

Work with an enum class of warehouse categories: switch over it for labels, parse names into an out-parameter, and convert a category to its index and step to the next one.

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

Inventory Summary

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

Summarise a warehouse stock list of structs: units per category in a std::array indexed by an enum class, a restock list of returned structs, deliveries booked through an iterator, and category summaries.

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.