1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
#include <deque>
#include <string>
int main() {
std::deque<std::string> colors;
// Adding elements to the back
colors.push_back("Red");
colors.push_back("Green");
colors.push_back("Blue");
// Adding an element to the front (for comparison)
colors.push_front("Yellow");
// Printing the deque
std::cout << "Colors in the deque:" << std::endl;
for (const auto& color : colors) {
std::cout << color << " ";
}
std::cout << std::endl;
return 0;
}
Back to push_back