summaryrefslogtreecommitdiff
path: root/8p10.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-10-06 21:28:38 +0200
committerOskar <[email protected]>2024-10-06 21:28:38 +0200
commit0921163e1f88c8e80991f0c94e0fc70c6dcba72d (patch)
tree878b49f5971e6469b9bb65e5c69ce37644ad8730 /8p10.cpp
parent19419d86cb88981df7973b08a0da6373abfba566 (diff)
more
Diffstat (limited to '8p10.cpp')
-rw-r--r--8p10.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/8p10.cpp b/8p10.cpp
new file mode 100644
index 0000000..6b1ce76
--- /dev/null
+++ b/8p10.cpp
@@ -0,0 +1,42 @@
+#include <iostream>
+#include <vector>
+#include <string>
+#include <sstream>
+#include <fstream>
+
+/*
+ *
+ * 8.10
+ *
+ *
+ */
+
+int main (int argc, char **argv) {
+
+ if(argc < 2 || argc > 2) {
+ return -1;
+ }
+
+ std::ifstream file(argv[1]);
+ if(file.fail()) {
+ std::cerr << argv[0] << ": cannot open file '" << argv[1] << "'" << std::endl;
+ return -1;
+ }
+
+ std::vector<std::string> all_lines;
+ std::string cur_line;
+ while(getline(file, cur_line)) {
+ all_lines.push_back(cur_line);
+ }
+
+ for(auto &ref_all_lines : all_lines) {
+ std::istringstream is(ref_all_lines);
+ std::string is_tmp;
+ while(is >> is_tmp) {
+ std::cout << is_tmp << "\n";
+ }
+ }
+
+ std::cout << std::ends;
+ return 0;
+}