OIO - simple bt good game play
available on appstore

OIO iphone game :)
amazing puzzle game

this is pseodocode:

while(password!=stored_password)
{
    cout<<"try again!";
    cin>>password;    
}
I hope it will help!