lab4.1 converted to library

main + header + implementation