求一个C++程序,输入用户名和密码

2024-12-31 23:03:46
推荐回答(1个)
回答1:

string usrname="duoduo"; //待匹配的用户名

string password=“mypassword”; //带匹配的密码

bool checkUserPass(string usrname,string mypassword){
string SucUsrname=“duoduo”;
string SucPassword="mypassword";

if(usrname.equal(SucUsrname)&&mypassword.equal(SucPassword)){
getAccess();

}else{
noAccess();

}

}

void getAccess(){
cout>>"Accessed Successfully">>"\n";

}

void noAccess(){
cout>>"Access denied">>"\n";

}

希望能够帮到你!