aboutsummaryrefslogtreecommitdiff
path: root/challenge-173/ulrich-rieke/cpp/ch-2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-173/ulrich-rieke/cpp/ch-2.cpp')
-rw-r--r--challenge-173/ulrich-rieke/cpp/ch-2.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-173/ulrich-rieke/cpp/ch-2.cpp b/challenge-173/ulrich-rieke/cpp/ch-2.cpp
new file mode 100644
index 0000000000..e3f10739ab
--- /dev/null
+++ b/challenge-173/ulrich-rieke/cpp/ch-2.cpp
@@ -0,0 +1,23 @@
+#include <iostream>
+#include <boost/multiprecision/cpp_int.hpp>
+
+int main( ) {
+ //to avoid a wraparound for the rapidly increasing numbers even
+ //the data type long long isn't long enough , so an extra library
+ //from boost had to do the job of creating long ints of sufficient
+ //precision
+ using boost::multiprecision::cpp_int ;
+ int x = 2 ;
+ std::cout << x << std::endl ;
+ int y = 3 ;
+ std::cout << y << std::endl ;
+ cpp_int lastProduct = static_cast<cpp_int>(x * y) ;
+ int count = 0 ;
+ while ( count != 8 ) {
+ cpp_int newElement = lastProduct + 1 ;
+ std::cout << newElement << std::endl ;
+ lastProduct *= newElement ;
+ count++ ;
+ }
+ return 0 ;
+}