diff options
author | Mike Buland <mike@xagasoft.com> | 2013-05-09 15:44:34 -0600 |
---|---|---|
committer | Mike Buland <mike@xagasoft.com> | 2013-05-09 15:44:34 -0600 |
commit | 0e5e01b4d0d5f3f872d97c95bd57fd057e4fd5a1 (patch) | |
tree | 1e6a657c57ceeda4d699f1f0b55ad033e3cacf7b /src/options.cpp | |
parent | ce68e816bd82612c14f3492e8bc969da9bfab06c (diff) | |
download | clic-0e5e01b4d0d5f3f872d97c95bd57fd057e4fd5a1.tar.gz clic-0e5e01b4d0d5f3f872d97c95bd57fd057e4fd5a1.tar.bz2 clic-0e5e01b4d0d5f3f872d97c95bd57fd057e4fd5a1.tar.xz clic-0e5e01b4d0d5f3f872d97c95bd57fd057e4fd5a1.zip |
Added Number::toRadix & Number::set( int32_t ).
Both very handy. I'll add other numeric setters later, it was very
easy.
Diffstat (limited to '')
-rw-r--r-- | src/options.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/options.cpp b/src/options.cpp index d9cd8f1..59dd2b4 100644 --- a/src/options.cpp +++ b/src/options.cpp | |||
@@ -19,7 +19,8 @@ Options::Options( int argc, char *argv[] ) : | |||
19 | addOption( Bu::slot(this, &Options::textPrimes), "text-primes", | 19 | addOption( Bu::slot(this, &Options::textPrimes), "text-primes", |
20 | "Generate primes in base 36 that only have digits > 9 in them."); | 20 | "Generate primes in base 36 that only have digits > 9 in them."); |
21 | addOption( Bu::slot(this, &Options::isPrime), 'p', "is-prime", | 21 | addOption( Bu::slot(this, &Options::isPrime), 'p', "is-prime", |
22 | "Test if the given number is prime. Set radix first."); | 22 | "Tests every parameter after to see if it is prime then prints out " |
23 | "the ones that are prime. Set radix first."); | ||
23 | addHelpOption('h', "help", "This help"); | 24 | addHelpOption('h', "help", "This help"); |
24 | 25 | ||
25 | parse( argc, argv ); | 26 | parse( argc, argv ); |
@@ -93,12 +94,9 @@ int Options::isPrime( Bu::StringArray aArgs ) | |||
93 | one = "1"; | 94 | one = "1"; |
94 | fact = "2"; | 95 | fact = "2"; |
95 | 96 | ||
96 | Bu::println("Radix: %1").arg( iRadix ); | ||
97 | |||
98 | for( Bu::StringArray::iterator i = aArgs.begin()+1; i; i++ ) | 97 | for( Bu::StringArray::iterator i = aArgs.begin()+1; i; i++ ) |
99 | { | 98 | { |
100 | tst = *i; | 99 | tst = *i; |
101 | Bu::println("%1").arg( tst ); | ||
102 | max = tst / fact; | 100 | max = tst / fact; |
103 | bool bPrime = true; | 101 | bool bPrime = true; |
104 | for( j = "2"; j < max; j = j + one ) | 102 | for( j = "2"; j < max; j = j + one ) |