// A basic password program
#include <iostream>
using namespace std;

int main() {

  string passwd = "xj3", p;
  int chance = 3;

  do {

    cout << "Input the password: ";
    cin  >> p;

    if(p != passwd)
      cout << "Wrong password, try again.\n";
    else break;

    chance--;

   } while(chance>0);

   // this return value will be used by another application
   if (chance) return 0;
   else {
     cout << "Too many wrong attempts.\n";
     return 1;
   }

}
