From 0921163e1f88c8e80991f0c94e0fc70c6dcba72d Mon Sep 17 00:00:00 2001 From: Oskar Date: Sun, 6 Oct 2024 21:28:38 +0200 Subject: more --- 8p10.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 8p10.cpp (limited to '8p10.cpp') 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 +#include +#include +#include +#include + +/* + * + * 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 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; +} -- cgit v1.2.3