mercredi 18 décembre 2019

Login Function in c++

vector <user> users;

void Login() {
    int index = 0;
    string n, Phone;
    cout << "Enter your name:" << endl;
    cin.ignore();
    getline(cin, n);
    cout << "Enter Your Phone Number: " << endl;
    cin.ignore();
    getline(cin, Phone);
    for (int i = 0; i < users.size(); i++) {
        if (users[i].name == n) {
            index = i;
        }
    }
    users[index].viewContact();
}

I made a Login function It's so simple without files or DataBase , Just without closing the console the user choose log out then a function login appear, so the user when he registered his information stored in vector , I called the the vector again in login but it didn't work

Aucun commentaire:

Enregistrer un commentaire