model automat,c++