1个回答
展开全部
#include <iostream>
#include <string>
using namespace std;
const string map[3][2] = {
"user1", "123455",
"user2", "asdfasdf",
"root", "password"
};
int main()
{
string name,pw;
int i;
while(cin >> name >> pw)
{
for(i = 0; i < 3; i ++)
{
if(map[i][0] == name)break;
}
if(i == 3) cout << "no such user name\n";
else if(map[i][1] != pw)
cout << "password error\n";
else break;
}
cout << "Login ok, welcome "<< name << endl;
cout << "no function, logout and exit\n";
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询