fork download
  1. //4 digit unlock code
  2.  
  3. #include <iostream>
  4. using namespace std;
  5. int main() {
  6. string passcode="1234";
  7. string enter="";
  8. cin>>enter;
  9. while(1){
  10. if(enter!=passcode){
  11. cout<<enter<<" is incorrect. Please, try again!"<<endl;
  12. cin>>enter;
  13. }
  14. else{
  15. cout<<"Hacked succuessfully!"<<endl;
  16. break;
  17. }
  18. }
  19. }
Success #stdin #stdout 0s 4908KB
stdin
1
12
123
1432
3241
1243
1234
stdout
1 is incorrect. Please, try again!
12 is incorrect. Please, try again!
123 is incorrect. Please, try again!
1432 is incorrect. Please, try again!
3241 is incorrect. Please, try again!
1243 is incorrect. Please, try again!
Hacked succuessfully!