Color theme
0 day streak0 XPP1
C++Learn mode
MISSION 1 OF 1

Add a reserved seat

0 XP earned
C++ track: MasterMission: BeginnerVectorsAppending elementsContainer size
Before you start this master track

Typed functions and collections. Be ready to reason about references, aliasing, and iterators.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 2 challenges
LEARN THE CONCEPT

Understand it, then try it.

A vector stores a sequence and can grow when another element is added. The string element type keeps each seat label as text. push_back appends a seat after the existing entries. back reads the last entry, while size reports how many entries the vector currently contains.

mission.cpp
#include <iostream>#include <string>#include <vector>int main() {  std::vector<std::string> seats = {"A1", "B2"};  seats.push_back("C4");  std::cout << seats.back() << " / " << seats.size() << '\n';}

Each example is a complete C++17 console program with its own main function and required standard-library headers. Compile and run one mission at a time.

Track the values line by line. Predict the result before running this example in your own editor.