#include <iostream>
#include <cassert>

struct day_of_year
{
    day_of_year( int d = 1 ) : day(d) {}

    operator int() const { return day ; }

    static constexpr int MAX = 365 ;

    day_of_year& operator++ () { ++day ; if( day > MAX ) day = 1 ; return *this ; }
    day_of_year operator++ (int) { day_of_year temp = *this ; ++*this ; return temp ; }

    int day ;
};

int main()
{
    day_of_year d = 350 ;
    while(  d > 1 )  std::cout << d++ << '\n' ;
    assert( d == 1 ) ;
}
