Build a Book Initialization System

Hard Object Lifecycle (Constructors & Destructors) PRO
🔒 Login to Unlock

Problem Statement

Build a `Book` class taking a string `title`. The parameterized constructor prints ‘Init: [title]’. The copy constructor prints ‘Copy: [title]’. The destructor prints ‘Clean: [title]’. Read a title string, instantiate `b1`, and copy it to `b2`.

Input Format

A single string title.

Output Format

Print the lifecycle progression line by line.

Constraints

None

Sample Input

C++

Sample Output

Init: C++
Copy: C++
Clean: C++
Clean: C++

Explanation

This ties the entire lifecycle together: parameterized initialization, copying, and finally LIFO destruction when the program exits.

Starter Code

#include <iostream>
#include <string>

class Book {
    // Implement the lifecycle functions
};

int main() {
    std::string t;
    if (std::cin >> t) {
        // Instantiate b1 and copy to b2
    }
    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