From 11729b4dfe96caa837da10389d91318ec43c8a65 Mon Sep 17 00:00:00 2001 From: Pranav Srinivas Kumar Date: Mon, 1 Apr 2019 21:53:04 -0400 Subject: [PATCH] Update README.md --- README.md | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b063c7..27ff6c3 100644 --- a/README.md +++ b/README.md @@ -27,12 +27,20 @@ Argparse supports a variety of argument types including positional, optional, an Here's an example of a ***positional argument***: ```cpp -program.add_argument("square") - .help("display the square of a given integer") - .action([](const std::string& value) { return pow(std::stoi(value), 2); }); +#include -program.parse_args(argc, argv); -std::cout << program.get("square") << std::endl; +int main(int argc, char *argv[]) { + argparse::ArgumentParser program("program name"); + + program.add_argument("square") + .help("display the square of a given integer") + .action([](const std::string& value) { return pow(std::stoi(value), 2); }); + + program.parse_args(argc, argv); + std::cout << program.get("square") << std::endl; + + return 0; +} ``` And running the code: