题目:https://pintia.cn/problem-sets/994805260223102976/problems/994805266007048192
代码
#include<string>#include<cstdio>#include<iostream>using namespace std;int main(){string ans, input;int n, count = 0, flag = 0;cin>>ans>>n;getchar();getline(cin, input);while(input != "#" && count < n){count++;if(input == ans){printf("Welcome in\n");flag = 1;break;} else {cout<<"Wrong password: " + input<<endl;}getline(cin, input);}if(count == n && flag == 0) printf("Account locked\n");return 0;}
