aboutsummaryrefslogtreecommitdiff
path: root/challenge-180/deadmarshal/cpp/ch-2.cpp
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2022-09-02 11:08:44 +0100
committerGitHub <noreply@github.com>2022-09-02 11:08:44 +0100
commit8162d93f3469587093f2c5a0d6e8cbdef9434e47 (patch)
treebe5db0f4e83e316b47fbcc702ebfa6979e8d395d /challenge-180/deadmarshal/cpp/ch-2.cpp
parent91d665102ab1b10f30b41bcf87195be8565053ae (diff)
parent29b273fc146113e127bd1664dd8d198d4ad2dcbd (diff)
downloadperlweeklychallenge-club-8162d93f3469587093f2c5a0d6e8cbdef9434e47.tar.gz
perlweeklychallenge-club-8162d93f3469587093f2c5a0d6e8cbdef9434e47.tar.bz2
perlweeklychallenge-club-8162d93f3469587093f2c5a0d6e8cbdef9434e47.zip
Merge pull request #6683 from deadmarshal/challenge180
challenge180
Diffstat (limited to 'challenge-180/deadmarshal/cpp/ch-2.cpp')
-rw-r--r--challenge-180/deadmarshal/cpp/ch-2.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/challenge-180/deadmarshal/cpp/ch-2.cpp b/challenge-180/deadmarshal/cpp/ch-2.cpp
new file mode 100644
index 0000000000..1ae978920c
--- /dev/null
+++ b/challenge-180/deadmarshal/cpp/ch-2.cpp
@@ -0,0 +1,26 @@
+#include<iostream>
+#include<vector>
+#include<algorithm>
+
+int main()
+{
+ std::vector<int> n{1,4,2,3,5};
+ std::vector<int> n2{9,0,6,2,3,8,5};
+ int i = 3, i2 = 4;
+ auto removed = std::remove_if(n.begin(),
+ n.end(),
+ [&i](int num){return num <= i;});
+ n.erase(removed, n.end());
+ for(const int& item : n)
+ std::cout << item << ' ';
+ std::cout << '\n';
+
+ auto removed2 = std::remove_if(n2.begin(),
+ n2.end(),
+ [&i2](int num){return num <= i2;});
+ n2.erase(removed2, n2.end());
+ for(const int& item : n2)
+ std::cout << item << ' ';
+
+ return 0;
+}