基础实验5-2.3 QQ帐户的申请与登陆 (25 分)
#include<iostream>
#include<string>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
set<string> s;
map<string,string> m;
int main()
{
int n;
cin>>n;
while(n--)
{
char a;
string b,c;
cin>>a>>b>>c;
if(a=='N')
{
if(s.count(b))
cout<<"ERROR: Exist"<<endl;
else
{
s.insert(b);
m[b]=c;
cout<<"New: OK"<<endl;
}
}
else
{
if(s.count(b)==0)
cout<<"ERROR: Not Exist"<<endl;
else
{
if(m[b]==c)
cout<<"Login: OK"<<endl;
else
cout<<"ERROR: Wrong PW"<<endl;
}
}
}
}