From d5fcdab87a013b2c919b66ea9a52b469620ca49f Mon Sep 17 00:00:00 2001 From: Oskar Date: Sat, 5 Oct 2024 14:23:02 +0200 Subject: more --- 8p1.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 8p1.cpp (limited to '8p1.cpp') diff --git a/8p1.cpp b/8p1.cpp new file mode 100644 index 0000000..1ad9fe5 --- /dev/null +++ b/8p1.cpp @@ -0,0 +1,34 @@ +#include + +/* + * + * 8.1 + * + * + */ + +std::istream &read_print_report(std::istream &rpr) { + + int a; + while(rpr >> a) { + std::cout << a; + } + + if(rpr.good()) { std::cout << "good" << std::endl; } + if(rpr.eof()) { std::cout << "eof" << std::endl; } + if(rpr.fail()) { std::cout << "fail" << std::endl; } + if(rpr.bad()) { std::cout << "bad" << std::endl; } + rpr.clear(); + std::cout << "--- cleared --- \n"; + if(rpr.good()) { std::cout << "good" << std::endl; } + if(rpr.eof()) { std::cout << "eof" << std::endl; } + if(rpr.fail()) { std::cout << "fail" << std::endl; } + if(rpr.bad()) { std::cout << "bad" << std::endl; } + return rpr; +} + +int main () { + + read_print_report(std::cin); + return 0; +} -- cgit v1.2.3