题意:L代表登录;R代表注册,,后面为qq号、密码,问qq的几种登录状态
tip:map
#include<iostream>
#include<map>
using namespace std;
int main() {
int n;
cin>>n;
map<string,string> m;//账号+密码
map<string,int>checked;//是否注册过
for(int i=0; i<n; ++i) {
string cmd,qq_no,pw;
cin>>cmd>>qq_no>>pw;
if(cmd=="L") {
if(checked[qq_no]) {
if(pw==m[qq_no])
cout<<"Log in Successful\n";
else cout<<"ERROR: Wrong Password\n";
} else
cout<<"ERROR: Account Not Exist\n";
} else if(cmd=="R") {
if(checked[qq_no])
cout<<"ERROR: Account Number Already Exists\n";
else {
checked[qq_no]=1;
m[qq_no]=pw;
cout<<"Register Successful\n";
}
}
}
return 0;
}