首页 > 其他 > 详细

PAT QQ帐户的申请与登陆 STL-MAP的应用

时间:2015-05-12 15:43:22      阅读:344      评论:0      收藏:0      [点我收藏+]

链接:

QQ帐户的申请与登陆




#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
using namespace std;
int main()
{
    int n;
    char ch;
    string str1,str2;
    map<string,string>mapp;
    map<string,string>::iterator ii;
    scanf("%d",&n);
    for(int i=1; i<=n; i++)
    {
        cin>>ch>>str1>>str2;
        ii=mapp.find(str1);
        if(ch=='N')
        {
            if(ii==mapp.end())
            {
                cout<<"New: OK"<<endl;
                mapp[str1]=str2;
            }
            else
                cout<<"ERROR: Exist"<<endl;
        }
        else if(ch=='L')
        {
            if(ii==mapp.end())
                cout<<"ERROR: Not Exist"<<endl;
            else if(ii->first.compare(str1)==0)
            {
                if(ii->second.compare(str2)==0)
                    cout<<"Login: OK"<<endl;
                else
                    cout<<"ERROR: Wrong PW"<<endl;
            }
        }
    }
return 0;
}


PAT QQ帐户的申请与登陆 STL-MAP的应用

原文:http://blog.csdn.net/axuan_k/article/details/45669237

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!