aboutsummaryrefslogtreecommitdiff
path: root/challenge-183/ulrich-rieke/cpp/ch-1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-183/ulrich-rieke/cpp/ch-1.cpp')
-rw-r--r--challenge-183/ulrich-rieke/cpp/ch-1.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/challenge-183/ulrich-rieke/cpp/ch-1.cpp b/challenge-183/ulrich-rieke/cpp/ch-1.cpp
new file mode 100644
index 0000000000..b6496b0a06
--- /dev/null
+++ b/challenge-183/ulrich-rieke/cpp/ch-1.cpp
@@ -0,0 +1,34 @@
+#include <utility>
+#include <algorithm>
+#include <vector>
+#include <iostream>
+#include <set>
+
+int main( ) {
+ std::cout << "Enter some numbers sequentially in pairs ( 0 to end )!\n" ;
+ std::pair<int , int> input ;
+ std::vector<std::pair<int , int>> allInput ;
+ std::set<std::pair<int , int>> seenSoFar ;
+ int a ;
+ int b ;
+ std::cin >> a ;
+ std::cout << "second number?\n" ;
+ std::cin >> b ;
+ while ( b != 0 ) {
+ input = std::make_pair( a , b ) ;
+ allInput.push_back( input ) ;
+ std::cout << "First integer:\n" ;
+ std::cin >> a ;
+ std::cout << "second integer ( 0 to end ):\n" ;
+ std::cin >> b ;
+ }
+ std::cout << '[' ;
+ for ( auto it = allInput.begin( ) ; it != allInput.end( ) ; ++it ) {
+ if ( seenSoFar.find( *it ) == seenSoFar.end( ) ) {
+ std::cout << '[' << it->first << ',' << it->second << "]," ;
+ seenSoFar.insert( *it ) ;
+ }
+ }
+ std::cout << ']' << std::endl ;
+ return 0 ;
+}