working cpp adaption of list.c 10/10 in grader