#include #include int main() { std::ifstream fh("data1.txt"); if ( fh ) { std::cout << "File opened OK" << std::endl; } else { std::cout << "Opening File Failed" << std::endl; return 1; } int number ; while(fh >> number) { if ( number == 0 ) { std::cout << "Found a Zero: Breaking Loop" << std::endl; break; } std::cout << "Found number: " << number << std::endl; if ( fh.eof() ) { std::cout << "EOF" << std::endl; break; } } }