有没有人可以帮帮我,呜

img

回答:程序非常简单,可能不太符合你的要求,如果放在文件内,会稍复杂些,代码如下:

#include<stdio.h>
#include<iostream>
using namespace std;

int main() {
    string pwd = "00000";
    string input;

    cout << "请设置密码(初始密码为00000),若不设置则不输入,默认为初始密码" << endl;
    cin >> pwd;
    cout<<endl;
    if (pwd != "") {
        cout << "The new key has been successfully set up!"<<endl;
        cout << "请输入开锁密码:";
        cin >> input;
        if (input == pwd) {
            cout << "It has been successfully unlocked!"<<endl;
        }
        else {
            cout << "Error pwd!";
        }
    }
    else {
        pwd = "00000";
        cout << "请输入开锁密码:";
        cin >> input;
        if (input == pwd) {
            cout << "It has been successfully unlocked!"<<endl;
        }
        else {
            cout << "Error pwd!"<<endl;
        }
    }
}

img