summaryrefslogtreecommitdiff
path: root/8p1.cpp
blob: 1ad9fe5027c1ef4d54e01213f90e4071cf46a324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>

/*
 *
 * 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;
}