mirror of
https://github.com/KeqingMoe/argparse.git
synced 2025-07-03 22:54:39 +00:00
Merge branch 'master' of https://github.com/p-ranav/argparse
This commit is contained in:
commit
5bf9b958f6
@ -29,10 +29,10 @@ 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) { auto integer = std::stoi(value); return integer * integer; });
|
||||
.action([](const std::string& value) { return pow(std::stoi(value), 2); });
|
||||
|
||||
program.parse_args(argc, argv);
|
||||
std::cout << program.get<int>("square") << std::endl;
|
||||
std::cout << program.get<double>("square") << std::endl;
|
||||
```
|
||||
|
||||
And running the code:
|
||||
|
Loading…
Reference in New Issue
Block a user