Final Capstone STL Iterators Project

Hard STL Iterators PRO
🔒 Login to Unlock

Problem Statement

Write a C++ program implementing a custom forward iterator for a container class to enable range-based for loops.

Input Format

First line: N. Second line: N space-separated integers.

Output Format

Print container elements accessed via custom iterator in range-based for loop separated by a space.

Constraints

1 <= N <= 100

Sample Input

5
10 20 30 40 50

Sample Output

10 20 30 40 50

Explanation

Capstone project integrating custom iterator architecture to support modern range-based iteration.

Starter Code

#include <iostream>

class SimpleContainer {
private:
    int arr[100];
    int size;

public:
    SimpleContainer(int n) : size(n) {}

    void set(int idx, int val) {
        arr[idx] = val;
    }

    class Iterator {
    private:
        int *ptr;
    public:
        Iterator(int *p) : ptr(p) {}
        bool operator!=(const Iterator &other) const { return ptr != other.ptr; }
        int& operator*() { return *ptr; }
        // Implement increment operator++ here
    };

    // Implement begin() and end() methods here
};

int main() {
    int n;
    if (std::cin >> n) {
        SimpleContainer sc(n);
        for (int i = 0; i < n; i++) {
            int val;
            std::cin >> val;
            sc.set(i, val);
        }
        bool first = true;
        for (int val : sc) {
            if (!first) std::cout << " ";
            std::cout << val;
            first = false;
        }
        std::cout << "n";
    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used