diff options
| author | 冯昶 <seaker@qq.com> | 2021-03-15 18:13:51 +0800 |
|---|---|---|
| committer | 冯昶 <seaker@qq.com> | 2021-03-15 18:13:51 +0800 |
| commit | 8b6be37fe4dac8b4c6489a95e55514b76b298d15 (patch) | |
| tree | ae36c8ec2c71f606c0e36adaa19dba366a68a0b4 /challenge-002/paulo-custodio/cpp/ch-1.cpp | |
| parent | 865acfd056fb6f409ec6b1a81d60b931cbcb69fe (diff) | |
| parent | c9aec2da6bcb04b488183f09ca94bee488557aff (diff) | |
| download | perlweeklychallenge-club-8b6be37fe4dac8b4c6489a95e55514b76b298d15.tar.gz perlweeklychallenge-club-8b6be37fe4dac8b4c6489a95e55514b76b298d15.tar.bz2 perlweeklychallenge-club-8b6be37fe4dac8b4c6489a95e55514b76b298d15.zip | |
Merge branch 'master' of github.com:seaker/perlweeklychallenge-club
Diffstat (limited to 'challenge-002/paulo-custodio/cpp/ch-1.cpp')
| -rw-r--r-- | challenge-002/paulo-custodio/cpp/ch-1.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/challenge-002/paulo-custodio/cpp/ch-1.cpp b/challenge-002/paulo-custodio/cpp/ch-1.cpp new file mode 100644 index 0000000000..1399dfe279 --- /dev/null +++ b/challenge-002/paulo-custodio/cpp/ch-1.cpp @@ -0,0 +1,18 @@ +/* +Challenge 002 + +Challenge #1 +Write a script or one-liner to remove leading zeros from positive numbers. +*/ + +#include <iostream> +#include <cctype> + +int main(int argc, char* argv[]) { + if (argc==2) { + char* p = argv[1]; + while (*p=='0' && isdigit(p[1])) + p++; + std::cout << p << std::endl; + } +} |
