summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-08-30 22:00:39 +0200
committerOskar <[email protected]>2024-08-30 22:00:39 +0200
commit0963b6f2cc8f191caef88008cf296e0f8f30b918 (patch)
treef4e747c3b3611ae291bb8499dda81e39e8748b76
parent1e4270a7110858d6f5d4cdf12f37d78dc81bc7d9 (diff)
more
-rw-r--r--5p16.cpp3
-rw-r--r--5p20.cpp30
2 files changed, 32 insertions, 1 deletions
diff --git a/5p16.cpp b/5p16.cpp
index 27c6bcb..cd152ee 100644
--- a/5p16.cpp
+++ b/5p16.cpp
@@ -1,5 +1,6 @@
#include <iostream>
#include <vector>
+#include <unistd.h>
/*
*
@@ -40,7 +41,7 @@ void nonidiomatic_for(std::vector<int> &nidf) {
}
int main (int argc, char *argv[]) {
-
+
if(argc > 2 || argc < 2) { return -1; }
std::string argv_s = argv[1];
std::vector<int> iv1;
diff --git a/5p20.cpp b/5p20.cpp
new file mode 100644
index 0000000..3dbb40f
--- /dev/null
+++ b/5p20.cpp
@@ -0,0 +1,30 @@
+#include <iostream>
+
+/*
+ *
+ * 5.20
+ *
+ *
+ */
+
+int main () {
+
+ std::string s;
+ std::string tmp;
+ bool b = false;
+ while(std::cin >> s) {
+ if(tmp == s) {
+ b = true;
+ break;
+ }
+ tmp = s;
+ }
+
+ if(b) {
+ std::cout << tmp << std::endl;
+ } else {
+ std::cout << "There were no repeating words" << std::endl;
+ }
+
+ return 0;
+}