5-15 QQ帐户的申请与登陆 (25分)

5-15 QQ帐户的申请与登陆 (25分)_第1张图片 5-15 QQ帐户的申请与登陆 (25分)_第2张图片
#include "string" 
#include "iostream"
#include "map"
using namespace std;
map<string,string> Q;

int main( ) 
{
    // freopen("1.txt","r",stdin);
	int m;
	cin>>m;
	string a3,a2;
	char a1;
	while(m--)
	{
		cin>>a1>>a2>>a3;
		if(a1=='N')
		{
			if(Q.find(a2)==Q.end())
			{
				Q[a2]=a3;
				cout<<"New: OK"<<endl;
			}
			else
			{
				cout<<"ERROR: Exist"<<endl;
			}
		}
		if(a1=='L')
		{
			if(Q.find(a2)==Q.end())
			{
				cout<<"ERROR: Not Exist"<<endl;
			}
			else
			{
				map<string,string>::iterator it;
				it=Q.find(a2);
				if(it->second==a3)
				{
					cout<<"Login: OK"<<endl;
				}
				else
				{
					cout<<"ERROR: Wrong PW"<<endl;
				}
			}
 		
		}
	}
	
	
	
	
	return 0;
}

5-15 QQ帐户的申请与登陆 (25分)_第3张图片

你可能感兴趣的:(5-15 QQ帐户的申请与登陆 (25分))