summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
+}