Password Authentication c++

后端 未结 4 1631
野的像风
野的像风 2021-01-25 23:25

Hi this is my first time using classes so apologies for my poor explanation. Basically I am making a password function for an elevator program. LogIn is the name of my class, wh

4条回答
  •  [愿得一人]
    2021-01-25 23:51

    I think the code should be like this:

    while (1)
        {
            if (Authenticate.getName() == Authenticate.getNameAttempt())
            {
                return true;
            }
            else        
            {
                if (attempts++ == 2)
                {
                    return false;
                }
                cout << "Incorrect name. Try again" << endl;
                cout << "" << endl;
    
                cout << "Enter Name:" << endl;
                cin >> nameAttempt;
    
                Authenticate.setNameAttempt(nameAttempt);
            }
        }
    

提交回复
热议问题