Username and password. Can't get the true false thing in this code to behave correctly.
PS it's long. I can't wrap my head around why i get "login successfull" when the username is wrong: So here's a very long code with an additional unessecary function call vy reference just for the fun of it: #include<iostream> #include<string> #include<vector> class Users { private: std::string m_username; std::string m_password; public: void setUsername(std::string username) { m_username = username; } void setPassword(std::string password) { m_password = password; } bool checkUsername(std::string username) { if (username == m_username) { return true; } else { return false; } } bool checkPassword(std::string password) { if (password == m_password) { return true; } else { return false; } } }; void setUsernameAndPassword(Users &user, std::string username, std::string password) { user.setUsername(username); user.setPassword(password); } void menu(std::vector<Users> &userVector) { std::cout << "1.New user\n2.Open user" << std::endl; int input; std::cin >> input; if (input == 1) { std::string username; std::string password; Users newUser; std::cout << "Enter username: "; std::getline(std::cin, username); std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); std::cout << "Enter password: "; std::getline(std::cin, password); //std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); setUsernameAndPassword(newUser, username, password); userVector.push_back(newUser); } if (input == 2) { //Print user id's std::cout << "Available users: " << std::endl; for (int n = 0; n < userVector.size(); n++)