#include "enor.h"
#include <iostream>

using namespace std;

Enor::Enor(const string &str)
{
    x.open(str.c_str());
    if(x.fail()) throw FILEOPENERROR;
}

void Enor::read()
{
    x >> dx;
    sx = (x.fail())? abnorm : norm;
}

void Enor::First()
{
    read();
    end = abnorm==sx;
    if(norm==sx) akt = dx-48; // akt = (ch=='0')?0:1;
}

void Enor::Next()
{
    end = abnorm==sx;
    if(norm==sx){
        akt = 0;
        char ch = dx;
        for(; norm==sx && dx==ch; read()){
            ++akt;
        }
    }
}
