如何在 if 语句中打印消息?

how can I print a message in if statement?

#include <iostream>
#include<string>
using namespace std;
int main() {
    string username, password, option, admin, client,type;
    cout << "enter the username" << endl;
    cin >> username;
    cout << "enter the password" << endl;
    cin >> password;
    cout << "are you admin or client?" << endl;
    cin >> option;
    if (option == admin) {
        cout << "Add a New Account." << endl;
        cout << "Modify An Account." << endl;
        cout << "Close An Account." << endl;
        cout << "List All Accounts." << endl;
    }
    else if (option == client) {
        cout << "Balance Enquiry" << endl;
        cout << "Withdraw Amount." << endl;
        cout << "Deposit Amount." << endl;
        cout << "Transfer from his account to another account." << endl;
    }
    cout << "Register as admin/client?" << endl;
    cin >> type;
    cout << "log out" << endl;

    return 0;
}

这 2 条消息您是管理员还是客户? && 注册为admin/client?在if语句中没有输入就出现在彼此后面

如果将两个 if 语句检查更改为如下所示:

    if (option == "admin") {
        ...
    } else if (option == "client") {
        ...
    }

它可能会工作得更好,因为目前它正在检查空字符串。