1067. 试密码(20) PAT 乙级

来源:互联网 发布:手机壁纸设置软件 编辑:程序博客网 时间:2024/06/11 08:18

传送门

#include<iostream>using namespace std;int main(){    string passwd,input;    int n;    cin>>passwd>>n;    getchar();    int count=0;    while(true){        getline(cin,input);        if(input=="#"){            break;        }        count++;        if(input==passwd){            cout<<"Welcome in";            break;        }        if(input!=passwd){            cout<<"Wrong password: "<<input<<endl;        }        if(count==n){            cout<<"Account locked";            break;        }       }}
0 0