some code written while learning cpp and java