title: Login system using classes c++
body: <p>Hello I try to implement a login system but I tried so many times and I still don't get it.
  I have a class user and a class login, and a test function..i tried this after a tutorial, but there it was a default username and password, and only that one worked in login, but i need to have the possibility of each user's login;</p>
  
  <pre><code>class User{
  
  private:
  
  char *username;
  char *password;
  
  public:
  User(){}
  User(char *,char *p){...}
  ~User();
  friend ostream &amp;operator&lt;&lt;(ostream &amp;output, User &amp;u);
  char* getUsername(){...};
  char* getPassword(){...};
  };
  
  class Loginn
  {
  public:
      string username;
      string password;
  
      Loginn()
      {
          username = "\0";
          password = "\0";
      }
  
      };
  
  bool Loginn::ptlogin(User users[])
  {
      int x;
      string ch_username = users[x].getUsername;
      string ch_password = users[x].getPassword;
      cout &lt;&lt; "Enter username::\t";
      cin &gt;&gt; username;
      cout &lt;&lt; "Enter password::\t";
      cin &gt;&gt; password;
  
  
      if ((username == ch_username)&amp;&amp;(password =ch_password))
      {
          return true;
      }
      else
      {
          return false;
      }
  }
  
  
  void MainMenu(User users[]);
  {
  //this is from where I want to call login function, not from main()
  }
  
  void main()
  {
  
  
      User u2("Jamie15","t3456");
      User u3("Chris","fgh6");
  
  User users[2]={u2,u3};
  
  MainMenu(users);
  
  
  }
  </code></pre>
  
  <p>I want my login system to test if the username and password entered match to a user's password and username, my users are u2 and u3. Thank you!
  Also, the data type from user needs to stay char, i cannot change it.</p>