#include <iostream>
#include <string>
using namespace std;

class Safe {
public:
    string password;

    Safe(string pw) : password(pw) {}

    void open(string input_pw) {
        if (input_pw == password)
            cout << "열렸습니다" << endl;
        else
            cout << "비밀번호가 다릅니다" << endl;
    }
};

int main() {
    Safe s("1234");
    s.open("0000"); 
    s.open("1234"); 
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: