#include <boost/program_options.hpp>
using namespace boost;
using namespace boost::program_options;
#include <iostream>
using namespace std;
int main(int ac, const char **av)
{
try {
options_description desc("Allowed options");
desc.add_options()
("help", "", "produce a help screen")
("version,v", "", "print the version number")
("string,s", "arg", "output the specified string")
;
options_and_arguments oa = parse_command_line(ac, av, desc);
if (oa.count("help")) {
cout << "Usage: options_description [options]\n";
cout << desc;
return 0;
}
if (oa.count("version")) {
cout << "Version 1.\n";
return 0;
}
if (oa.count("string")) {
cout << "The string is \"" << oa["string"] << "\"\n";
}
}
catch(exception& e)
{
cout << e.what() << "\n";
}
}