Password Authentication c++

后端 未结 4 1632
野的像风
野的像风 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:42

    Try this, sweet and simple:

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

提交回复
热议问题