Contert main to cpp file