【发布时间】:2021-04-29 17:50:58
【问题描述】:
#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 条消息你是管理员还是客户? && 注册为管理员/客户?在 if 语句中不输入就出现在彼此的后面
【问题讨论】:
-
我认为您的意思是
if ( option == "admin" )和else if类似 -
您有名为
admin和client的字符串,但它们是空的
标签: c++ if-statement project message cout