title: Having an Object-Oriented mindset to verify a programs arguments
body: <p>I need to verify the options passed to my program that looks like such:</p>
  
  <pre><code>./prog -n teamName -p port -h host
  </code></pre>
  
  <p>I am coding a client in C++ and, apparently, verified these parameters in a C-like fashion. Being rather new to C++ it is very important to me to have the right mindset when developing something in an Object-oriented manner.</p>
  
  <p>As an example, here is how I am doing this verification so far:</p>
  
  <pre><code>int     verify_arguments(int ac, char **av)
  {
    int           i;
    std::string   arg;
    std::string   team_name;
    int           port;
    std::string   ip("0");
  
    i = 1;
    while (i &lt; ac)
      {
        arg = av[i];
        if (arg.compare("-n") == 0)
          {
            if ((team_name = verify_n(av, i)) == "")
              return (-1);
            i++;
          }
        else if (arg.compare("-p") == 0)
          {
            if ((port = verify_p(av, i)) == -1)
              return (-1);
            i++;
          }
        else if (arg.compare("-h") == 0)
          {
            if ((ip = verify_h(av, i)) == "")
              return (-1);
            i++;
          }
        else
          {
            std::cerr &lt;&lt; "The option " &lt;&lt; arg &lt;&lt; " does not exist." &lt;&lt; std::endl;
            return (-1);
          }
        i++;
      }
    std::cout &lt;&lt; "Team name is: " &lt;&lt; team_name &lt;&lt; "\nPort is: " &lt;&lt; port &lt;&lt; "\nIP is: " &lt;&lt; ip &lt;&lt; std::endl;
    if (port != -1 &amp;&amp; ip.compare("KO") != 0)
      connect_to_server(team_name, port, ip);
    return (0);
  }
  </code></pre>
  
  <p>It is rather obvious why I wish to change this completely to fit the C++ style.</p>
  
  <p>What is the best way to do it? When it comes to C++ arguments verification, what is the right path to take?</p>